Project starter: ipal-kit create <domain> generates a new site from the reference site

- bin `ipal-kit` (subcommand `create`): the architecture questions (or --answers JSON),
  rendering from reference/ through starter.manifest.json (placeholders, @starter:if variants,
  //: alternatives, demo dropped), answers into AGENTS.md "Project decisions" and ipal-doctor.json,
  local .env with a fresh PAYLOAD_SECRET, install from the shipped lockfile, ipal-skills,
  ipal-tokens, generate:types/importmap, typecheck, ipal-doctor when shipped, secret check,
  first commit
- @intecion/ipal-kit/starter: the building blocks (renderSite, validateAnswers, applyVariants,
  collectBundle, lockfileWithoutPlugin, secretFindings …)
- build:starter packs reference/ into dist/starter/template.json.gz (90 KB);
  starter:gate in prepublishOnly: site from the packed tarball, frozen install, seed, build,
  targeted SEED_ONLY seed in production mode, full seed refused, pnpm start checks
- D15: plugin dependencies pinned exactly (nodemailer 10.3.1)
- reference/: @starter:if markers (runs as before), manifest generate/variants/rewrite
- docs: project-starter.md, AGENT.md, ipal-setup, ipal-site, ipal-reference (+ api.md),
  README, PROGRAMISTA §2, CHANGELOG, docs/README, reference index

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 15:50:44 +01:00
co-authored by Claude Opus 5.5
parent 154049662e
commit 804a09efed
43 changed files with 2902 additions and 99 deletions
+20 -3
View File
@@ -1,9 +1,10 @@
/**
* Seeds of the reference site — rules: node_modules/@intecion/ipal-kit/docs/seeding.md.
*
* pnpm seed # everything: demo layer first (filled pages win), then the base layer
* pnpm seed:base # only what every new site keeps (the project starter runs this one)
* pnpm seed:demo # only the made-up company's content (needs the base forms)
* pnpm seed # the reference site: demo layer first (filled pages win), then the base layer;
* # a site made by `ipal-kit create`: the base layer only
* pnpm seed:base # only what every new site keeps
* pnpm seed:demo # reference site only: the made-up company's content (needs the base forms)
* SEED_DRY_RUN=1 pnpm seed # print the plan, write nothing
*
* VERY IMPORTANT — after launch: never the whole seed again. Name the records the run may touch:
@@ -16,34 +17,50 @@ import { createSeeder } from '@intecion/ipal-kit/seed'
import { getPayload } from 'payload'
import { seedBaseGlobals, seedBaseNavigation, seedBasePages, seedBaseTexts } from './base'
// @starter:if demo
import { DEMO_NOTIFY_EMAIL, seedDemoGlobals, seedDemoNavigation, seedDemoPages } from './demo'
// @starter:endif
import { seedForms } from './forms'
// @starter:if demo
import { seedMedia } from './media'
// @starter:endif
// @starter:if demo
const layer = process.env.SEED_LAYER ?? 'all'
const withDemo = layer === 'all' || layer === 'demo'
const withBase = layer === 'all' || layer === 'base'
// @starter:else
//: const withBase = true // a new site has only the base layer (the reference site's demo is not copied)
// @starter:endif
const payload = await getPayload({ config })
const seed = createSeeder(payload)
// @starter:if demo
const media = withDemo ? await seedMedia(payload) : {}
if (withDemo) {await seedDemoGlobals(seed, media)}
// @starter:endif
if (withBase) {await seedBaseGlobals(seed)}
// Forms need the inbox that receives submissions: SEED_NOTIFY_EMAIL, else the Company global — never a guess.
const company = (await payload.findGlobal({ slug: 'company' })) as { email?: null | string }
// @starter:if demo
const notifyTo = process.env.SEED_NOTIFY_EMAIL?.trim() || (withDemo ? DEMO_NOTIFY_EMAIL : company.email?.trim()) || ''
// @starter:else
//: const notifyTo = process.env.SEED_NOTIFY_EMAIL?.trim() || company.email?.trim() || ''
// @starter:endif
if (/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]+$/.test(notifyTo)) {
await seedForms(seed, notifyTo)
} else {
console.error('[seed] Forms skipped: fill Company → E-mail in the panel or run with SEED_NOTIFY_EMAIL=… (ask the client which inbox).')
}
// @starter:if demo
if (withDemo) {
await seedDemoPages(seed, media)
await seedDemoNavigation(seed)
}
// @starter:endif
if (withBase) {
await seedBasePages(seed)
await seedBaseNavigation(seed)