diff --git a/docs/agent/skills/ipal-audit/scripts/audit.sh b/docs/agent/skills/ipal-audit/scripts/audit.sh index 7225b75..4446dc0 100644 --- a/docs/agent/skills/ipal-audit/scripts/audit.sh +++ b/docs/agent/skills/ipal-audit/scripts/audit.sh @@ -41,7 +41,9 @@ report() { [ "$count" -gt 20 ] && printf ' … and %s more\n' "$((count - 20))" } -g() { grep -rnE "$@" 2>/dev/null || true; } +# grep that skips the starter's alternative lines (`//: …` after `file:line:`) — commented-out +# variants inside @starter:if markers, not code the site runs. +g() { grep -rnE "$@" 2>/dev/null | grep -vE '^[^:]+:[0-9]+:[[:space:]]*//:' || true; } # drop matches that sit inside a // or /* comment (keeps http:// URLs) # (also a whole-line comment right after grep's "file:line:" prefix) nc() { grep -vE "^[^:]+:[0-9]+:[[:space:]]*(//|/?\*)|(^|[^:])//.*$1|/\*.*$1" || true; } diff --git a/reference/.agents/skills/ipal-audit/scripts/audit.sh b/reference/.agents/skills/ipal-audit/scripts/audit.sh index 7225b75..4446dc0 100644 --- a/reference/.agents/skills/ipal-audit/scripts/audit.sh +++ b/reference/.agents/skills/ipal-audit/scripts/audit.sh @@ -41,7 +41,9 @@ report() { [ "$count" -gt 20 ] && printf ' … and %s more\n' "$((count - 20))" } -g() { grep -rnE "$@" 2>/dev/null || true; } +# grep that skips the starter's alternative lines (`//: …` after `file:line:`) — commented-out +# variants inside @starter:if markers, not code the site runs. +g() { grep -rnE "$@" 2>/dev/null | grep -vE '^[^:]+:[0-9]+:[[:space:]]*//:' || true; } # drop matches that sit inside a // or /* comment (keeps http:// URLs) # (also a whole-line comment right after grep's "file:line:" prefix) nc() { grep -vE "^[^:]+:[0-9]+:[[:space:]]*(//|/?\*)|(^|[^:])//.*$1|/\*.*$1" || true; } diff --git a/reference/.agents/skills/ipal-reference/SKILL.md b/reference/.agents/skills/ipal-reference/SKILL.md index 6783ea8..f35ba4c 100644 --- a/reference/.agents/skills/ipal-reference/SKILL.md +++ b/reference/.agents/skills/ipal-reference/SKILL.md @@ -197,6 +197,7 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip | a11y widget CSS | `styles.css` | `@import "@intecion/ipal-kit/a11y.css";` (only with ``) | widget options change the page | accessibility.md | | `/its` panel | `app/(payload)/its/…` | `adminRoute: '/its'` + `its` in the proxy matcher | `/its` login, `/admin` 404 | security.md | | skills | `package.json` | `"ipal:skills": "ipal-skills"` | `.agents/skills/` up to date | PROGRAMISTA §2.1a | +| a new site | CLI (from the parent folder) | `pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@ create [--answers answers.json] [--dir] [--external] [--no-install] [--no-git] [--dry-run]`; in a project: `pnpm exec ipal-kit create --dir ../-web`. Building blocks: `@intecion/ipal-kit/starter` (resources/api.md) | one commit, `AGENTS.md` decisions filled, `pnpm typecheck` passes | project-starter.md | | eject a library block | CLI | `pnpm exec ipal-blocks list` / `pnpm exec ipal-blocks eject faq [--dest src/blocks] [--dry-run]` → `src/blocks/Faq/`; then the ejected builder in `blockOptions`' place and `components: { faq: FaqBlock }` | the block renders from the project file | block-library.md "Own blocks and eject" | **`createContentHelpers` keys (exports of `@/lib/content`)** — all lazy and cached per request: diff --git a/reference/.agents/skills/ipal-reference/resources/api.md b/reference/.agents/skills/ipal-reference/resources/api.md index 3e63e4d..4ec4ddc 100644 --- a/reference/.agents/skills/ipal-reference/resources/api.md +++ b/reference/.agents/skills/ipal-reference/resources/api.md @@ -1,7 +1,7 @@ # ipal-kit — export index Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`, -`/server`, `/seed`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep +`/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep (`grep -n "name" .agents/skills/ipal-reference/resources/api.md`) before you write anything yourself. "Import from" column — the first entry is preferred. Plugin options, env, routes and what the project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/docs/.md`. @@ -742,6 +742,31 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP **Types:** `ThemeOptions` (root, `ipalKit({ theme })`), `Theme`, `ThemeSetting`, `ThemeConfig` (root, `/client`) — theme, setting from the panel and theme options; `ThemeScriptProps` (`/rsc`), `ThemeSwitcherProps`, `ThemeSwitcherClassNames` (`/client`) — component props. +## Project starter (`starter`) — details: `node_modules/@intecion/ipal-kit/docs/project-starter.md` + +Bin: `ipal-kit create ` (`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@ create …`). +`@intecion/ipal-kit/starter` uses Node built-ins only (no Payload) — the building blocks of the command. + +| Export | Import from | What it does / when | +|---|---|---| +| `runCreateCli(args, log?)`, `CREATE_USAGE` | `@intecion/ipal-kit/starter` | The command (`ipal-kit create`) — returns the exit code. | +| `parseCreateArgs(args)`, `normalizeDomain(input)`, `localEnv(example)` | `@intecion/ipal-kit/starter` | Its pieces: options, `https://www.X.pl/` → `x.pl` (punycode), `.env` with a fresh `PAYLOAD_SECRET`. | +| `validateAnswers(input)`, `STARTER_TOPICS` | `@intecion/ipal-kit/starter` | The architecture answers (`StarterAnswers`): every missing / invalid one as a line; `[]` = valid. | +| `flagsFromAnswers(answers)` | `@intecion/ipal-kit/starter` | The `@starter:if` flags the answers turn on (`twoFactor`, `posts`, `crawl`, `r2`, `enforceCsp: false`, `demo: false`…). | +| `askAnswers(ask)` | `@intecion/ipal-kit/starter` | The questions with any `ask(question) → Promise` (terminal, chat bridge). | +| `collectBundle(dir)`, `packBundle(bundle)`, `unpackBundle(buffer)`, `bundleFlags(bundle)` | `@intecion/ipal-kit/starter` | `reference/` → the bundle (fails on a fake value in a kept file) → gzip and back; the flags the markers use. | +| `renderSite(bundle, answers, ctx)`, `placeholderValues(answers, ctx)` | `@intecion/ipal-kit/starter` | The new site's files (path → content), in memory; the value of every `{{token}}`. | +| `applyVariants(text, flags, file?)`, `variantFlags(text)` | `@intecion/ipal-kit/starter` | `@starter:if` / `else` / `endif` blocks (nesting; `//: ` / `#: ` lines uncommented inside kept blocks). | +| `applyPlaceholders(text, fakes, values)`, `leftoverFakes(text, fakes)` | `@intecion/ipal-kit/starter` | Fake values → the site's values (longest first); what is left. | +| `assertManifest(value)`, `fileRole(path, manifest)`, `matchGlob(path, glob)`, `ALWAYS_SKIPPED` | `@intecion/ipal-kit/starter` | `starter.manifest.json`: drop / generate / template / keep. | +| `renderI18nConfig`, `renderTokens`, `renderDesignMd`, `renderAgentsMd`, `renderDecisions`, `renderDoctorConfig` | `@intecion/ipal-kit/starter` | Files and sections written from the answers (languages, brand, DESIGN.md, AGENTS.md decisions, ipal-doctor.json). | +| `rewriteFonts(layout, answers)`, `fontExport(name)`, `rewritePackageJson(text, rules, ctx, answers)` | `@intecion/ipal-kit/starter` | next/font calls → the answered fonts; the manifest's package.json rewrite. | +| `lockfileWithoutPlugin(lock)` | `@intecion/ipal-kit/starter` | The reference lockfile without the plugin (shipped with the bundle). | +| `secretFindings(files)` | `@intecion/ipal-kit/starter` | The pre-commit check: `.env*`, assigned secrets, private keys. | + +**Types:** `StarterAnswers`, `AnalyticsTool`, `ContentCollection` — the answers; `StarterBundle`, `StarterManifest`, `FileRole`, +`StarterFlags`, `SiteContext` — the bundle, the manifest, the flags and the site context (all `/starter`). + ## Design tokens (`tokens`) — details: `node_modules/@intecion/ipal-kit/docs/design-tokens.md` CSS: `@intecion/ipal-kit/tokens.css` (neutral `--ipal-*` defaults, light/dark, `[data-surface="inverse"]`), `@intecion/ipal-kit/tailwind.css` diff --git a/reference/.agents/skills/ipal-setup/SKILL.md b/reference/.agents/skills/ipal-setup/SKILL.md index 1dcf130..b7a98a2 100644 --- a/reference/.agents/skills/ipal-setup/SKILL.md +++ b/reference/.agents/skills/ipal-setup/SKILL.md @@ -66,7 +66,22 @@ propose a concrete choice and get a yes before you build it. ## 1. Installation -**Steps.** Scaffold: `npx create-payload-app@latest ` (Blank, Postgres/Mongo), delete the starter +**New site: `ipal-kit create` does stages 1–10 in one command** (`node_modules/@intecion/ipal-kit/docs/project-starter.md`). +After stage 0, write the answers as JSON (shape `StarterAnswers` from `@intecion/ipal-kit/starter`) and run, from the +folder that will hold the project (needs the `@intecion` registry line in `~/.npmrc`): +```bash +pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@ create --answers answers.json +``` +It generates the site from the reference site, writes `.env` (fresh `PAYLOAD_SECRET`), installs from the shipped +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 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. + +**Steps (manual path).** Scaffold: `npx create-payload-app@latest ` (Blank, Postgres/Mongo), delete the starter `src/app/(frontend)/layout.tsx` and `page.tsx` (the frontend root becomes `[locale]/layout.tsx`). Do not create `middleware.ts` (Next 16 = `proxy.ts`; delete an existing one). Never install from git (`git+https://…`). ```ini diff --git a/reference/.agents/skills/ipal-site/SKILL.md b/reference/.agents/skills/ipal-site/SKILL.md index 9b670c7..78c2de7 100644 --- a/reference/.agents/skills/ipal-site/SKILL.md +++ b/reference/.agents/skills/ipal-site/SKILL.md @@ -45,7 +45,12 @@ decision on that part; no hand-built replacement, no silent workaround. **Code r decision (AGENT §0a) and on a plugin gap (ipal-plugin-gap — report, wait for the owner). ## Phase 1 — Foundation -- New project → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`). Every file you wire has its canonical +- **New site → `ipal-kit create`** with the phase-0 answers as JSON (`docs/project-starter.md`): + `pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@ create --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 (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. - Existing project on an older ipal-kit → **ipal-upgrade** before anything else. diff --git a/test/doctor.test.ts b/test/doctor.test.ts index 6287f72..0b33416 100644 --- a/test/doctor.test.ts +++ b/test/doctor.test.ts @@ -82,6 +82,22 @@ describe('helpers', () => { }) }) +describe('ipal-audit through the doctor', () => { + const site = (contentTs: string) => + project({ ...base(), 'src/lib/content.ts': contentTs, 'src/payload.config.ts': "import { payloadTotp } from '@clocklimited/payload-2fa'\n" }) + const aiBots = async (root: string) => (await doctor(root, ['audit'])).findings.filter((f) => f.rule === 'audit:robots-blocks-ai-bots') + + test("a starter alternative line (//: …) with aiBots: 'block-training' is not a finding", async () => { + const root = site("export const content = createContentHelpers({\n // @starter:if aiBotsBlockTraining\n //: robots: { aiBots: 'block-training' },\n // @starter:endif\n})\n") + expect(await aiBots(root)).toEqual([]) + }) + + test("a real robots: { aiBots: 'block-training' } line still is", async () => { + const root = site("export const content = createContentHelpers({\n robots: { aiBots: 'block-training' },\n})\n") + expect((await aiBots(root)).map((f) => f.severity)).toEqual(['warning']) + }) +}) + describe('versions', () => { test('a current project passes', async () => { expect(rules(await doctor(project(base()), ['versions']))).toEqual([])