IAPL rename: the old names keep working, and a second cookie name and counter key for new sites

- exports: ipalKit, IpalOptions, ipalEnvRules, IpalEnvFeatures, ipalT, ipalVar, IPAL_TOKENS,
  IPAL_BREAKPOINTS, IpalTokenName, IpalGlobalSlug are aliases of the iapl names
- env: IAPL_* is read first, IPAL_* as fallback (readEnv; EnvRule.aliases for assertEnv);
  the crawler service reads IPAL_CRAWLER_SITES too
- doctor: reads ipal-doctor.json when it is the only one, the old pointer block, ipal-audit-skip
  and old skill folders; new rule legacy-names (info) and storage-names (warning)
- iapl-skills: installs iapl-*, removes the 16 old folders by exact name, rewrites the old
  pointer block in place; a project's own ipal-* skill stays
- storageNames: 'ipal' (default) | 'iapl': the cookie the scanner declares and the 2FA counter's
  kv prefix; <PageStats visitorCookie>, IAPL_VISITOR_COOKIE, verifyLimit.keyPrefix
- test/legacyNames.test.ts: 24 tests for all of the above

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 17:31:13 +01:00
co-authored by Claude Fable 5.2
parent 0a4f001797
commit 425fac14fb
43 changed files with 683 additions and 82 deletions
+18
View File
@@ -28,6 +28,7 @@ import type { RequireSetupOptions } from './modules/security/totp/setupRequired.
import type { VerifyLimitOptions } from './modules/security/totp/verifyLimit.js'
import type { SeoOption } from './modules/seo/types.js'
import type { StatsOptions } from './modules/stats/collection.js'
import type { StorageNames } from './modules/stats/visitorCookie.js'
/**
* Configuration options for the IAPL plugin.
@@ -236,6 +237,20 @@ export type IaplOptions = {
*/
stats?: boolean | StatsOptions
/**
* Which spelling the two stored names of the plugin have on this site (docs/stats.md,
* docs/security.md): the visitor cookie (`ipal_vid` / `iapl_vid`) as the cookie scanner
* declares it, and the 2FA attempt counter's key in `payload.kv`
* (`ipal:2fa-verify:…` / `iapl:2fa-verify:…`).
*
* Default `'ipal'` — what every site made before 1.17.0 has, so an upgrade changes nothing.
* The starter sets `'iapl'` for a new site, together with
* `<PageStats visitorCookie={IAPL_VISITOR_COOKIE} />` in the layout.
* Decide once: on a live site a change starts visitors' histories and the running 2FA counts
* again, and the cookie list has to be approved again.
*/
storageNames?: StorageNames
/**
* Light / dark theme. `storageKey`: the localStorage key of the visitor's
* choice — default `theme` (the next-themes key and values, so a project using
@@ -419,3 +434,6 @@ export type ThemeOptions = {
/** localStorage key of the visitor's light / dark choice. Default `'theme'`. */
storageKey?: string
}
/** @deprecated The name before 1.17.0; the same type as `IaplOptions`. Removed in 2.0. */
export type IpalOptions = IaplOptions