Merge claude/project-starter-build: ipal-kit create (project starter)

ipal-kit create <domain> generates a new site from the reference site (bin
ipal-kit, /starter entry, gzipped template bundle built at prepublishOnly,
starter:gate); exact pins of the plugin's own four dependencies (D15, nodemailer
10.3.1); the single-language / non-pl-default refusal; reference/ @starter:if
markers, packageManager, cookieCrawl.

Conflicts resolved:
- reference/src/instrumentation.ts: the starter's multi-line ipalEnvRules with
  the @starter:if markers (the doctor's cookieCrawl comment line merged above
  assertEnv already).
- reference/ipal-doctor.json: the doctor's version, keeping the four live-seo
  silences (until 2026-11-30) — the starter's side was the pre-silence copy.
- docs/agent/skills/ipal-reference/resources/api.md: both /starter and /doctor.
- docs/CHANGELOG.md: both sides in both hunks; one Unreleased section.
- docs/agent/reference-site/INDEX.md: regenerated with pnpm reference:index.
This commit is contained in:
Radosław Smoliński
2026-10-29 16:16:49 +01:00
43 changed files with 3100 additions and 94 deletions
+173 -41
View File
@@ -25,7 +25,9 @@ Rules: AGENT.md §13, §0a.
| `README.md` | how to run the reference site and what is where |
| `docs/DEPLOY.md` | the Coolify runbook: local check, app settings, MongoDB resource, env, targeted seeds, DNS, rollback |
| `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) |
| `next.config.ts` | security headers, enforced CSP, admin CSP, upload headers, images, no X-Powered-By (below) |
| `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) |
| `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) |
| `next.config.ts` | security headers, enforced CSP, admin CSP, upload headers, images, no X-Powered-By |
| `package.json` | scripts (build, start, seed, tokens, generate), pinned Payload versions and overrides |
| `playwright.config.ts` | smoke tests against the built, seeded site (below) |
| `postcss.config.mjs` | Tailwind 4 through PostCSS (below) |
@@ -100,46 +102,88 @@ legacy-peer-deps=true
}
```
### `next.config.ts`
### `ipal-doctor.json`
```ts
import type { NextConfig } from 'next'
import {
buildAdminCspHeaders,
buildImagesConfig,
buildSecurityHeaders,
buildUploadSecurityHeaders,
withSecurityConfig,
} from '@intecion/ipal-kit'
import { withPayload } from '@payloadcms/next/withPayload'
// CSP enforced: the reference site is the example after the report-only phase (security.md → "ROLL OUT CSP").
// Flags = what the site loads: Turnstile on forms, Google analytics/GTM when IDs are set in Site integrations.
const csp = { mode: 'enforce', r2Url: process.env.R2_PUBLIC_URL, reportUri: '/api/csp-report' } as const
const securityHeaders = buildSecurityHeaders({
csp: { ...csp, analytics: true, turnstile: true },
hsts: process.env.NODE_ENV === 'production',
})
const nextConfig: NextConfig = {
// ALLOW_LOCAL_MEDIA=1 (local / CI production checks only): let next/image optimize files the app serves on localhost
images: buildImagesConfig(process.env.ALLOW_LOCAL_MEDIA === '1' ? { production: false } : {}),
// Metadata in <head> for crawlers (deployment.md §3a)
htmlLimitedBots:
/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Yandex|DuckDuckBot|Baiduspider|Screaming Frog|AhrefsBot|SemrushBot/i,
async headers() {
return [
{ source: '/:path*', headers: securityHeaders },
{ source: '/admin/:path*', headers: buildAdminCspHeaders(csp) }, // after the site-wide rule
...buildUploadSecurityHeaders(),
]
},
```json
{
"domain": "example-studio.pl",
"launched": false,
"rules": {
"audit:collections-present": {
"off": true,
"reason": "Project decisions: posts and caseStudies with archive pages; entryFields.ts is their shared field helper, not a collection"
},
"i18n-literals": {
"off": true,
"files": [
"src/components/design/**"
],
"reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code"
},
"live-seo:duplicate-meta-descriptions-google-ignores-them": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: three pages per language have no own meta description and fall back to the site description; the seed should give each page one"
},
"live-seo:heading-levels-skipped": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the block-library track: entryList cards use h3 with no h2 on the archive pages (h1 → h3)"
},
"live-seo:first-image-not-prioritised-lcp": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the block-library track: on the archive pages the first image is an entryList card, which is not marked priority"
},
"live-seo:thin-pages-words": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: demo archive and service pages hold fewer than 150 words of made-up content"
}
}
}
```
// withSecurityConfig: no X-Powered-By (Next's and Payload's)
export default withPayload(withSecurityConfig(nextConfig))
### `ipal-doctor.json`
```json
{
"domain": "example-studio.pl",
"launched": false,
"rules": {
"audit:collections-present": {
"off": true,
"reason": "Project decisions: posts and caseStudies with archive pages; entryFields.ts is their shared field helper, not a collection"
},
"i18n-literals": {
"off": true,
"files": [
"src/components/design/**"
],
"reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code"
},
"live-seo:duplicate-meta-descriptions-google-ignores-them": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: three pages per language have no own meta description and fall back to the site description; the seed should give each page one"
},
"live-seo:heading-levels-skipped": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the block-library track: entryList cards use h3 with no h2 on the archive pages (h1 → h3)"
},
"live-seo:first-image-not-prioritised-lcp": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the block-library track: on the archive pages the first image is an entryList card, which is not marked priority"
},
"live-seo:thin-pages-words": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: demo archive and service pages hold fewer than 150 words of made-up content"
}
}
}
```
### `playwright.config.ts`
@@ -219,6 +263,8 @@ Rules: AGENT.md §3, ipal-setup stage 3.
| `src/db.ts` | the database adapter, alone in one file (MongoDB) (below) |
| `src/i18n.config.ts` | the ONLY source of languages (below) |
| `src/instrumentation.ts` | env validation at startup (assertEnv, database name rule) (below) |
| `src/instrumentation.ts` | env validation at startup (assertEnv, database name rule) (below) |
| `src/instrumentation.ts` | env validation at startup (assertEnv, database name rule) (below) |
| `src/payload.config.ts` | ipalKit with every module the site uses, R2, mail, 2FA, white-label |
| `src/proxy.ts` | the locale proxy with Markdown negotiation (not middleware.ts) (below) |
@@ -233,8 +279,12 @@ import type { ContentOption } from '@intecion/ipal-kit'
*/
export const contentConfig: ContentOption = {
collections: [
// @starter:if posts
{ slug: 'posts', label: 'Blog', perPage: 9 },
// @starter:endif
// @starter:if caseStudies
{ slug: 'caseStudies', label: 'Case studies', perPage: 9 },
// @starter:endif
],
}
```
@@ -279,9 +329,85 @@ export function register() {
// databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor).
// R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md).
assertEnv(
ipalEnvRules({ cookieCrawl: true, databaseName: { domain: 'example-studio.pl' }, ipHeader: true, storage: process.env.ALLOW_LOCAL_MEDIA !== '1' }).map((rule) =>
rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule,
),
ipalEnvRules({
// @starter:if crawl
cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
// @starter:endif
databaseName: { domain: 'example-studio.pl' },
// @starter:if graph
//: emailGraph: true, // GRAPH_* — e-mail through Microsoft Graph
// @starter:endif
ipHeader: true,
// @starter:if r2
storage: process.env.ALLOW_LOCAL_MEDIA !== '1',
// @starter:else
//: storage: false, // media on local disk — a Coolify persistent volume (AGENTS.md → Project decisions)
// @starter:endif
}).map((rule) => (rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule)),
)
}
```
### `src/instrumentation.ts`
```ts
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
export function register() {
if (process.env.NEXT_RUNTIME !== 'nodejs') {return}
// storage: R2 is required in production. ALLOW_LOCAL_MEDIA=1 lets a production build run on local disk for
// local checks and CI only — never set it in Coolify.
// cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service).
// databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor).
// R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md).
assertEnv(
ipalEnvRules({
// @starter:if crawl
cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
// @starter:endif
databaseName: { domain: 'example-studio.pl' },
// @starter:if graph
//: emailGraph: true, // GRAPH_* — e-mail through Microsoft Graph
// @starter:endif
ipHeader: true,
// @starter:if r2
storage: process.env.ALLOW_LOCAL_MEDIA !== '1',
// @starter:else
//: storage: false, // media on local disk — a Coolify persistent volume (AGENTS.md → Project decisions)
// @starter:endif
}).map((rule) => (rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule)),
)
}
```
### `src/instrumentation.ts`
```ts
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
export function register() {
if (process.env.NEXT_RUNTIME !== 'nodejs') {return}
// storage: R2 is required in production. ALLOW_LOCAL_MEDIA=1 lets a production build run on local disk for
// local checks and CI only — never set it in Coolify.
// cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service).
// databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor).
// R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md).
assertEnv(
ipalEnvRules({
// @starter:if crawl
cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
// @starter:endif
databaseName: { domain: 'example-studio.pl' },
// @starter:if graph
//: emailGraph: true, // GRAPH_* — e-mail through Microsoft Graph
// @starter:endif
ipHeader: true,
// @starter:if r2
storage: process.env.ALLOW_LOCAL_MEDIA !== '1',
// @starter:else
//: storage: false, // media on local disk — a Coolify persistent volume (AGENTS.md → Project decisions)
// @starter:endif
}).map((rule) => (rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule)),
)
}
```
@@ -604,12 +730,18 @@ import { libraryBlocks, type LibraryBlocksOptions } from '@intecion/ipal-kit/blo
export const blockOptions = {
contact: true,
cta: true,
// @starter:if collections
entryList: {
collections: [
// @starter:if posts
{ label: { en: 'Blog posts', pl: 'Wpisy' }, value: 'posts' },
// @starter:endif
// @starter:if caseStudies
{ label: { en: 'Case studies', pl: 'Realizacje' }, value: 'caseStudies' },
// @starter:endif
],
},
// @starter:endif
faq: true,
featureGrid: true,
gallery: true,