Starter: refuse single-language and non-pl-default sites explicitly (later); docs and tests
ipal-kit create stops before writing anything and points to the manual ipal-setup path; project-starter.md, AGENT.md, ipal-setup, ipal-site and the CHANGELOG say the same. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0170419473
commit
0dffb85ec1
+2
-1
@@ -23,7 +23,8 @@ fifteen ready page sections and ten page templates. A new site in one command: `
|
||||
(subcommand `create`), new entry `@intecion/ipal-kit/starter` with the building blocks (`renderSite`,
|
||||
`validateAnswers`, `applyVariants`, `collectBundle` …). New scripts `build:starter` and `starter:gate` in
|
||||
`prepublishOnly`: a site made from the packed tarball must install frozen, seed, build, run the targeted seed in
|
||||
production mode and serve `/pl` before a publish. Adds ~180 KB to the tarball.
|
||||
production mode and serve `/pl` before a publish. Adds ~180 KB to the tarball. Not yet: single-language sites and a
|
||||
default language other than `pl` — the command stops and points to the manual `ipal-setup` path.
|
||||
- **Design-token standard** ([design-tokens.md](./design-tokens.md)): one set of `--ipal-*` names for every site,
|
||||
only the values differ per brand. `@intecion/ipal-kit/tokens.css` (neutral defaults, light/dark on `data-theme`,
|
||||
`[data-surface="inverse"]` scope, reduced motion), `@intecion/ipal-kit/tailwind.css` (Tailwind 4 preset: `bg-surface`,
|
||||
|
||||
+2
-1
@@ -82,7 +82,8 @@ the ready-to-send list is in **ipal-setup** stage 0 (ipal-site phase 0 uses the
|
||||
@intecion/ipal-kit@<version> create <domain>` asks exactly these questions (or reads them from `--answers file.json`),
|
||||
generates the site from the reference site, writes the answers into `AGENTS.md` and makes the first commit. Ask the owner
|
||||
first, then pass the answers — the command never fills a gap. The manual path (`ipal-setup` stages 1–11) is for an
|
||||
existing project or what the command does not cover yet (another default language, no URL prefix, Postgres).
|
||||
existing project or what the command does not cover yet: **single-language sites, a default language other than `pl`**, sites
|
||||
without `en`, URLs without a prefix, Postgres — the command stops with a message pointing here.
|
||||
- Write every answer into the project's `AGENTS.md` → **"Project decisions"** (one line per topic).
|
||||
- **Do not guess a missing answer.** No answer to an architecture question → do not build that part; ask again.
|
||||
(Only *content* gaps — company data, texts, IDs — may wait: use `[TO FILL: …]` in the panel, §0a.)
|
||||
|
||||
@@ -76,7 +76,8 @@ It generates the site from the reference site, writes `.env` (fresh `PAYLOAD_SEC
|
||||
lockfile, runs `ipal-skills`, `ipal-tokens`, `generate:types`, `generate:importmap`, `typecheck` (and `ipal-doctor
|
||||
--strict` when shipped), checks for secrets and makes the first commit. **Check:** `git log --oneline` = 1 commit,
|
||||
`git status` clean, `AGENTS.md` → "Project decisions" holds every answer, `pnpm typecheck` passes. Then go to stage 11.
|
||||
**Turn off / override:** it refuses another default language than `pl`, sites without `en`, URLs without a prefix and
|
||||
**Turn off / override:** it stops (nothing written) for **single-language sites** and **a default language other than
|
||||
`pl`** (not supported yet), sites without `en`, URLs without a prefix and
|
||||
Postgres — use the stages below; every generated file is the project's own afterwards. The stages below are also the
|
||||
path for an existing project.
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ decision on that part; no hand-built replacement, no silent workaround. **Code r
|
||||
`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> --answers answers.json`.
|
||||
It generates the site from the reference site (every §0b item wired), installs the skills, writes the answers into
|
||||
`AGENTS.md`, and makes the first commit. Check: `git log --oneline` = 1 commit, `pnpm typecheck` passes. Then continue
|
||||
with phase 2. What it refuses (another default language, no URL prefix, Postgres) → the manual path below.
|
||||
with phase 2. What it refuses (a single-language site, a default language other than `pl`, no URL prefix, Postgres) → the manual path below.
|
||||
- New project without the command → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`). Every file you wire has its canonical
|
||||
version in the reference site: `node_modules/@intecion/ipal-kit/docs/agent/reference-site/INDEX.md` (AGENT.md
|
||||
"Reference site") — copy the pattern, change only the content.
|
||||
|
||||
@@ -42,9 +42,15 @@ Every answer is written into `AGENTS.md` → **Project decisions** (one line per
|
||||
`.ipal/starter.json`. A module the owner turns off needs the owner's reason, which goes into
|
||||
`ipal-audit-skip:` and `ipal-doctor.json` (`"rules": { "2fa": { "off": true, "reason": "…" } }`).
|
||||
|
||||
**Limits of this version** (the generator refuses, the manual `ipal-setup` path covers them): the default
|
||||
language must be `pl` and `en` must be one of the locales (the base seed is Polish + English, with Polish
|
||||
default-locale slugs); every language gets a URL prefix; MongoDB only.
|
||||
**Not supported yet — the command stops before writing anything** and points to the manual path (the
|
||||
`ipal-setup` skill, stages 1–11), which covers them:
|
||||
- **single-language sites** (owner's decision: later);
|
||||
- **a default language other than `pl`**, and sites without `en` — the base seed is Polish + English with Polish
|
||||
default-locale slugs;
|
||||
- URLs without a language prefix; Postgres (MongoDB only).
|
||||
|
||||
Check: `ipal-kit create acme.pl --answers single.json` with one locale exits 1 with "a single-language site is not
|
||||
supported by `ipal-kit create` yet — set the site up by hand with the ipal-setup skill", and the folder is not created.
|
||||
|
||||
For agents and CI, the same answers as JSON (shape: `StarterAnswers`, `@intecion/ipal-kit/starter`):
|
||||
|
||||
|
||||
@@ -102,8 +102,12 @@ export function validateAnswers(input: unknown): string[] {
|
||||
need(codes.length > 0 && codes.every((c) => typeof c === 'string' && LOCALE.test(c)), 'languages.locales: [{ code: "pl", label: "Polski" }, …]')
|
||||
need(Array.isArray(langs?.locales) && langs.locales.every((l) => isText(l?.label)), 'languages.locales: every locale needs a label')
|
||||
need(new Set(codes).size === codes.length, 'languages.locales: a code is listed twice')
|
||||
// The base seed writes Polish and English text and Polish default-locale slugs (reference/src/seed/base.ts).
|
||||
need(langs?.default === 'pl' && codes.includes('en'), 'languages: this version needs default "pl" and "en" among the locales (the base seed is Polish + English); other sites → the manual ipal-setup path')
|
||||
// Not in this version (owner's decision: later): the base seed writes Polish + English text with Polish
|
||||
// default-locale slugs, and the reference site has a [locale] segment (reference/src/seed/base.ts).
|
||||
const manual = 'is not supported by `ipal-kit create` yet — set the site up by hand with the ipal-setup skill (stages 1–11)'
|
||||
need(codes.length !== 1, `languages: a single-language site ${manual}`)
|
||||
need(codes.length === 1 || langs?.default === 'pl', `languages: a default language other than "pl" (here "${String(langs?.default)}") ${manual}`)
|
||||
need(codes.length <= 1 || codes.includes('en'), `languages: a site without "en" ${manual}`)
|
||||
|
||||
const st = a.styling
|
||||
need(isText(st?.primary), 'styling.primary: the brand colour (any CSS colour, oklch recommended)')
|
||||
|
||||
+24
-3
@@ -1,4 +1,4 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import { existsSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
renderI18nConfig,
|
||||
renderSite,
|
||||
rewriteFonts,
|
||||
runCreateCli,
|
||||
secretFindings,
|
||||
type SiteContext,
|
||||
type StarterAnswers,
|
||||
@@ -121,11 +122,31 @@ describe('starter: answers', () => {
|
||||
expect(validateAnswers(a)).toHaveLength(3)
|
||||
})
|
||||
|
||||
it('keeps to what the base seed backs: default pl, en present', () => {
|
||||
expect(validateAnswers(answers((x) => { x.languages.default = 'en' }))).toHaveLength(1)
|
||||
it('refuses single-language and English-default sites with a pointer to ipal-setup', () => {
|
||||
const single = validateAnswers(answers((x) => { x.languages.locales = [{ code: 'pl', label: 'Polski' }] }))
|
||||
expect(single).toHaveLength(1)
|
||||
expect(single[0]).toMatch(/single-language site is not supported by `ipal-kit create` yet .*ipal-setup/)
|
||||
const english = validateAnswers(answers((x) => { x.languages.default = 'en' }))
|
||||
expect(english).toHaveLength(1)
|
||||
expect(english[0]).toMatch(/default language other than "pl" \(here "en"\).*ipal-setup/)
|
||||
expect(validateAnswers(answers((x) => { x.languages.locales = [{ code: 'pl', label: 'Polski' }, { code: 'de', label: 'Deutsch' }] }))[0]).toMatch(/without "en"/)
|
||||
expect(validateAnswers(answers((x) => { x.languages.locales.push({ code: 'de', label: 'Deutsch' }) }))).toEqual([])
|
||||
})
|
||||
|
||||
it('stops the command before writing anything', async () => {
|
||||
const lines: string[] = []
|
||||
const dir = path.join(root, '.starter-test-single')
|
||||
const file = path.join(root, '.starter-test-answers.json')
|
||||
writeFileSync(file, JSON.stringify(answers((x) => { x.languages.locales = [{ code: 'pl', label: 'Polski' }] })))
|
||||
try {
|
||||
expect(await runCreateCli(['acme-test.pl', '--answers', file, '--dir', dir, '--no-install', '--no-git'], (line) => lines.push(line))).toBe(1)
|
||||
expect(lines.join('\n')).toMatch(/nothing was written[\s\S]*single-language site[\s\S]*ipal-setup/)
|
||||
expect(existsSync(dir)).toBe(false)
|
||||
} finally {
|
||||
rmSync(file, { force: true })
|
||||
}
|
||||
})
|
||||
|
||||
it('turns answers into the flags the reference markers test', () => {
|
||||
const flags = flagsFromAnswers(answers((x) => { x.consent.tools = ['metaPixel'] }))
|
||||
expect(flags).toMatchObject({ analytics: false, demo: false, enforceCsp: false, metaPixel: true, posts: true, scannerWithoutCrawl: true, twoFactor: true })
|
||||
|
||||
Reference in New Issue
Block a user