IAPL rename: readEnv exported, the MCP server name left as it was, legacy:site needs a database

- readEnv / legacyEnvName exported from the root and /env (a project's own code reads IAPL_* with the IPAL_* fallback);
  the name constants hold the IAPL_ spelling — changelog and env.md say so
- createMcpRoute: the default serverName stays 'ipal-site' (clients see it); the scripted step had changed it
- legacy:site: the builds read the database; the script and PROGRAMISTA say which

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 17:47:11 +01:00
co-authored by Claude Fable 5.2
parent 926ba4a67e
commit 3d5106bc4a
11 changed files with 20 additions and 7 deletions
+3
View File
@@ -32,6 +32,9 @@ once there are more than 20.
- **Not renamed:** the package and its import paths, import-map paths, routes `/api/ipal/*`, CSS tokens `--ipal-*`,
`data-ipal` hooks, `config.custom.ipal`, `req.context` flags, the `ipal` translation namespace, the header
`X-Ipal-Cookie-Crawler`. They change, with a migration path, in 2.0.
- The exported name constants `SITE_NOINDEX_ENV`, `COOKIE_SCAN_URL_ENV` and `COOKIE_SCAN_TOKEN_ENV` hold the `IAPL_`
spelling. The plugin reads both spellings itself; code of your own that does `process.env[SITE_NOINDEX_ENV]` should
call `readEnv(SITE_NOINDEX_ENV)` (new, from `/env` or the root) or `isSiteNoindex()`.
- Docs, the agent guide and the skills use the new names; `AGENT.md` has one table of old and new names
("Names: IAPL and ipal-kit").
- Audit findings whose titles named a command (`iapl-tokens --check`, "forms in iapl", `IAPL_IP_HEADER in .env.example`)
@@ -305,6 +305,7 @@ Opt-in with `iapl({ cookieScanner: true })`; the plugin wires the collection, en
| Export | Import from | What it does / when |
|---|---|---|
| `assertEnv(rules, { env?, label? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | validates `process.env` against the rules at startup; collects every missing item and throws one error |
| `readEnv(name, env?)`, `legacyEnvName(name)` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | Value of a plugin variable: `IAPL_<NAME>` first, the spelling before 1.17.0 (`IPAL_<NAME>`) when it is missing or empty. `legacyEnvName('IAPL_NOINDEX')` → `'IPAL_NOINDEX'`. For your own code that reads `IAPL_*`. |
| `iaplEnvRules({ storage?, emailGraph?, ipHeader?, turnstile?, serverUrlVar?, secretVar?, secretMinLength?, databaseVar?, databaseName? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | ready rule set (`DATABASE_URI`, `PAYLOAD_SECRET`, `NEXT_PUBLIC_SERVER_URL` + `R2_*`/`GRAPH_*`/Turnstile/`IAPL_IP_HEADER` depending on the features used) for `assertEnv`; `R2_PUBLIC_URL` optional unless `storage: { requirePublicUrl: true }`; `secretMinLength` (default 32, `0` = off) is the minimum `PAYLOAD_SECRET` length in production; `databaseName: true \| { domain?, warn? }` only warns when the `DATABASE_URI` database is not `<domain without dots>_prod` / `_dev` |
| `databaseNamesFor(domainOrUrl)` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | the two database names for a site: `intecion.com` → `{ prod: 'intecioncom_prod', dev: 'intecioncom_dev' }` (`www.` dropped, dots removed) |
| `databaseNameFromUri(uri)` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | the database name (URI path) of a Mongo / Postgres `DATABASE_URI`; null for SQLite files or no name |
+1 -1
View File
@@ -780,7 +780,7 @@ done until the reference site uses it. Before `npm version`:
and installed against this build without one edit: the old commands run, the doctor reports no error, the
committed import map and `tokens.css` are still current, `tsc` passes, and it builds with webpack and with
Turbopack. This is the proof that an existing site upgrades with no change (`scripts/legacy-site-check.mjs`;
no database needed). With it: `test/legacyNames.test.ts` (every old name) and `test/legacyNameForms.test.ts`
`DATABASE_URI` = a reachable local MongoDB, an empty one is enough). With it: `test/legacyNames.test.ts` (every old name) and `test/legacyNameForms.test.ts`
(no new name is born with the old spelling).
- [ ] **`pnpm e2e:built` green — required, no release without it.** It builds the reference site with webpack AND with
Turbopack (with the late-staff fixture, `E2E_LATE_STAFF=1`) and runs, on each built site: the account rules of
+6
View File
@@ -97,6 +97,12 @@ whose messages name the `IAPL_` spelling). Set one of the two; `iapl-doctor` (`l
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.
Reading one of the plugin's variables in your own code: `readEnv('IAPL_NOINDEX')` (from `@intecion/ipal-kit/env` or the
root) returns the `IAPL_` value, else the `IPAL_` one; `legacyEnvName('IAPL_NOINDEX')` is `'IPAL_NOINDEX'`. The exported
name constants (`SITE_NOINDEX_ENV`, `COOKIE_SCAN_URL_ENV`, `COOKIE_SCAN_TOKEN_ENV`) hold the `IAPL_` spelling since
1.17.0, so `process.env[SITE_NOINDEX_ENV]` alone no longer sees a variable set under the old name — use `readEnv`
(or `isSiteNoindex()`).
The plugin also reads (outside the preset — add your own rules if you want to validate them):
`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:
+1 -1
View File
@@ -79,7 +79,7 @@ runs `initialize` → `tools/list` → and can then call `get_site_info`,
| `content` | — | archive collections (`list_pages`, `get_page` for entries) |
| `summaryField` | — | field with a richer AI description (`buildSummaryField`), preferred in results |
| `isPathVisible` | — (from `createContentHelpers`: set) | `(path, locale) => boolean` — hides pages hidden by under-construction mode |
| `serverName` | `'iapl-site'` | name in `initialize` (and fallback site name) |
| `serverName` | `'ipal-site'` | name in `initialize` (and fallback site name) |
| `serverVersion` | `'1.0.0'` | version in `initialize` |
| `rateLimit` | `{ max: 60, windowMs: 60_000 }` | per-IP limit; `false` = off |
| `clientIp` | — | `{ header?, trustedProxies? }` — where to read the IP from (see [forms.md](./forms.md#client-ip-and-rate-limit)) |