IAPL rename: docs, agent guide, skills, reference site and starter on the new names; changelog draft

- docs, AGENT.md, the 16 skills, PROGRAMISTA and README use the preferred names (scripted, same list of forms);
  past CHANGELOG entries and the proposals in docs/dev are not rewritten
- AGENT.md: 'Names: IAPL and ipal-kit' — old name, new name, state in 1.x; what is not renamed; storageNames
- iapl-upgrade '→ 1.17.0', PROGRAMISTA §6 item 72, CHANGELOG 1.17.0 (draft): nothing required
- env.md, doctor.md (legacy-names, storage-names), stats.md, security.md, project-starter.md, iapl-reference, iapl-setup
- skill scripts read ipal-audit-skip and IPAL_IP_HEADER too; audit rule ids stay what they were
- reference site: iapl(), iapl-doctor.json, iapl-* skills, storageNames: 'iapl'; INDEX.md regenerated

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 17:36:09 +01:00
co-authored by Claude Fable 5.2
parent 425fac14fb
commit b91984fbcd
149 changed files with 1930 additions and 1747 deletions
+26 -20
View File
@@ -27,11 +27,11 @@ server startup):
```ts
// src/instrumentation.ts
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
import { assertEnv, iaplEnvRules } from '@intecion/ipal-kit/env'
export function register() {
if (process.env.NEXT_RUNTIME !== 'nodejs') return // Edge: no server process.env
assertEnv(ipalEnvRules({ storage: true, emailGraph: true, turnstile: true }))
assertEnv(iaplEnvRules({ storage: true, emailGraph: true, turnstile: true }))
}
```
@@ -39,18 +39,18 @@ export function register() {
> `instrumentation.ts` for Edge too. The package root pulls in Payload, `file-type`,
> `fs` — Turbopack fails (`Export fileTypeFromFile doesn't exist in target module`).
> `/env` is only the validator, zero dependencies. The root still exports `assertEnv`
> and `ipalEnvRules` (e.g. for `payload.config.ts`).
> and `iaplEnvRules` (e.g. for `payload.config.ts`).
**Turn off / override / extend:** validation is fully opt-in — the plugin never calls
`assertEnv` by itself; without this line nothing is checked. Replace any preset rule by filtering
the array (`ipalEnvRules(…).filter((r) => r.name !== 'X')`), add your own (spread below), or
the array (`iaplEnvRules(…).filter((r) => r.name !== 'X')`), add your own (spread below), or
write the whole set by hand.
Alternatively at the top of `payload.config.ts` (it loads both at build time and at
runtime). Server-side only (reads `process.env`) — do NOT import it
into a client component.
## ipalEnvRules — ready-made schema for the stack (opt-in)
## iaplEnvRules — ready-made schema for the stack (opt-in)
Builds the rule set from the features the project actually uses — a site on
local disk is not forced to set `R2_*`, a site without forms is not forced to set Turnstile.
@@ -58,11 +58,11 @@ It is not a rigid required set (A0: the plugin does not demand config you do not
use).
```ts
ipalEnvRules({
iaplEnvRules({
storage?: boolean | { requirePublicUrl?: boolean }, // R2_* (R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_ENDPOINT; R2_PUBLIC_URL optional)
emailGraph?: boolean, // GRAPH_* (GRAPH_TENANT_ID, GRAPH_CLIENT_ID, GRAPH_CLIENT_SECRET, GRAPH_SENDER — e-mail)
cookieCrawl?: boolean, // IPAL_COOKIE_SCAN_URL (url), IPAL_COOKIE_SCAN_TOKEN (≥ 16 chars) — required in production; cookieScanner.crawl (cookie-scanner.md)
ipHeader?: boolean, // IPAL_IP_HEADER — required in production, optional outside it (header name [a-z0-9-])
cookieCrawl?: boolean, // IAPL_COOKIE_SCAN_URL (url), IAPL_COOKIE_SCAN_TOKEN (≥ 16 chars) — required in production; cookieScanner.crawl (cookie-scanner.md)
ipHeader?: boolean, // IAPL_IP_HEADER — required in production, optional outside it (header name [a-z0-9-])
turnstile?: boolean | { siteKeyVar?: string; secretVar?: string }, // NEXT_PUBLIC_TURNSTILE_SITE_KEY, TURNSTILE_SECRET_KEY
serverUrlVar?: string, // default 'NEXT_PUBLIC_SERVER_URL'
secretVar?: string, // default 'PAYLOAD_SECRET'
@@ -75,10 +75,10 @@ ipalEnvRules({
Always (core): `DATABASE_URI`, `PAYLOAD_SECRET` (in production at least `secretMinLength` = 32 characters), `NEXT_PUBLIC_SERVER_URL` (URL),
`NODE_ENV` (optional, oneOf `development`/`production`/`test`). The names `R2_*` / `GRAPH_*` /
`NEXT_PUBLIC_SERVER_URL` / `IPAL_IP_HEADER` / Turnstile match what the plugin modules
`NEXT_PUBLIC_SERVER_URL` / `IAPL_IP_HEADER` / Turnstile match what the plugin modules
read; DB/secret are Payload variables — their names can be overridden.
**`storage: true` — when R2_* are required** (evaluated when `ipalEnvRules` is called):
**`storage: true` — when R2_* are required** (evaluated when `iaplEnvRules` is called):
- `NODE_ENV=production` → the 4 keys (`R2_BUCKET`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_ENDPOINT`);
- outside production, when any of the 4 keys is set → all 4 (all or none);
- outside production without keys → none required (local disk); `R2_PUBLIC_URL` alone passes
@@ -91,8 +91,14 @@ read; DB/secret are Payload variables — their names can be overridden.
from the panel first (Site integrations) and env is only a fallback — turn it on only when you keep the keys
in env.
**Names.** The plugin's own variables are `IAPL_<NAME>` since 1.17.0. A deploy that still sets `IPAL_<NAME>`
keeps working: `IAPL_…` is read first, `IPAL_…` when it is missing or empty (also by `assertEnv(iaplEnvRules())`,
whose messages name the `IAPL_` spelling). Set one of the two; `iapl-doctor` (`legacy-names`) warns when both are
set with different values. For your own rules: `{ name: 'NEW_NAME', aliases: ['OLD_NAME'] }` reads the old
name the same way. `ipalEnvRules` is the old name of `iaplEnvRules` and still exported.
The plugin also reads (outside the preset — add your own rules if you want to validate them):
`INDEXNOW_KEY` (seo.md), `IPAL_NOINDEX` (`1`/`true`/`yes` — staging, seo.md), `IPAL_DOCTOR_TOKEN` (≥ 32 characters —
`INDEXNOW_KEY` (seo.md), `IAPL_NOINDEX` (`1`/`true`/`yes` — staging, seo.md), `IAPL_DOCTOR_TOKEN` (≥ 32 characters —
turns `GET /api/ipal/doctor` on, doctor.md). Full table:
[deployment.md](./deployment.md).
@@ -100,7 +106,7 @@ Extending with your own variables — spread:
```ts
assertEnv([
...ipalEnvRules({ storage: true }),
...iaplEnvRules({ storage: true }),
{ name: 'MY_API_KEY', description: 'Key for integration X' },
])
```
@@ -108,7 +114,7 @@ assertEnv([
### Database names — `databaseName`
The naming rule (deployment.md §4.2a): the site's domain with the dots removed, plus `_prod` / `_dev` —
`intecion.com` → `intecioncom_prod` / `intecioncom_dev`. `ipalEnvRules({ databaseName: true })` adds a check that
`intecion.com` → `intecioncom_prod` / `intecioncom_dev`. `iaplEnvRules({ databaseName: true })` adds a check that
only **warns** (console, or your `warn`) when the database in `DATABASE_URI` breaks it. The domain comes from
`NEXT_PUBLIC_SERVER_URL` in `process.env` (localhost and dotless hosts are skipped) or from `{ domain }`.
@@ -128,7 +134,7 @@ assertEnv(rules: EnvRule[], options?: { env?, label? }): void
Collects ALL problems and throws one aggregated `Error`. With no
problems it does nothing. `options.env` (default `process.env`) makes testing easier;
`options.label` changes the prefix (default `[ipal]`).
`options.label` changes the prefix (default `[iapl]`).
### EnvRule
@@ -154,10 +160,10 @@ assertEnv([
])
```
### Sample message (preset `ipalEnvRules()`)
### Sample message (preset `iaplEnvRules()`)
```
[ipal] Environment validation failed (3 problems):
[iapl] Environment validation failed (3 problems):
• DATABASE_URI is required but missing — Database connection string (e.g. MongoDB URI)
• NEXT_PUBLIC_SERVER_URL must be a valid URL (got "example.com") — Public site origin, e.g. https://example.com
• NODE_ENV must be one of: development, production, test (got "prod") — Node environment
@@ -170,19 +176,19 @@ redeploys.
## Exports
```ts
import { assertEnv, checkDatabaseName, databaseNameFromUri, databaseNamesFor, ipalEnvRules } from '@intecion/ipal-kit/env'
import type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from '@intecion/ipal-kit/env'
import { assertEnv, checkDatabaseName, databaseNameFromUri, databaseNamesFor, iaplEnvRules } from '@intecion/ipal-kit/env'
import type { EnvRule, EnvKind, AssertEnvOptions, IaplEnvFeatures } from '@intecion/ipal-kit/env'
```
## `R2_PUBLIC_URL` — production vs dev
`R2_PUBLIC_URL` is optional in `ipalEnvRules({ storage: true })`: our default is media served through the app
`R2_PUBLIC_URL` is optional in `iaplEnvRules({ storage: true })`: our default is media served through the app
with `R2_PUBLIC_URL` **empty** (the client zones are not on Cloudflare — storage.md, deployment.md §6). When it is
set, **production** requires a full URL (`https://media.klient-media.com`). A project that always uses a media
domain requires it:
```ts
assertEnv(ipalEnvRules({ storage: { requirePublicUrl: true }, ipHeader: true }))
assertEnv(iaplEnvRules({ storage: { requirePublicUrl: true }, ipHeader: true }))
```
Outside production it allows a relative path