IAPL rename, review fixes I-1 to I-11

I-1  ipalEnvRules() keeps the IPAL_ rule names (IAPL_ as aliases); iaplEnvRules() the other way round; the IAPL_ value
     is the one checked when both are set
I-2  COOKIE_SCAN_URL_ENV / COOKIE_SCAN_TOKEN_ENV (and the internal SITE_NOINDEX_ENV) keep their old values;
     IAPL_COOKIE_SCAN_URL_ENV / IAPL_COOKIE_SCAN_TOKEN_ENV added
I-3  bin/ipal-*.mjs: five files that run the new ones (1.16's audit skill and CI call them by path); legacy:site checks it
I-4  storage-names sees <SiteProviders … stats> when a JSX prop comes first (the reference layout's shape)
I-5  AGENT.md: a text naming an ipal-<name> skill means iapl-<name> (the vendored ext-* skills)
I-6  leftover text in the skills-current message
I-7  iapl-skills removes the old pointer block when both are in AGENTS.md
I-8, I-11  changelog: the doctor's summary line, IAPL_DOCTOR_STATUS, --strict in CI until the skills are refreshed
I-9  env.md: an empty IAPL_ variable does not switch the IPAL_ one off
I-10 verifyLimit.keyPrefix undefined or empty is 'not given'

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 18:45:36 +01:00
co-authored by Claude Fable 5.2
parent 03452376f9
commit 38b903fcfa
25 changed files with 202 additions and 33 deletions
+8 -4
View File
@@ -8,8 +8,12 @@ import { DEFAULT_TRACKER_HOSTS } from './violations.js'
export const COOKIE_CRAWL_SLUG = 'cookie-crawl'
export const COOKIE_CRAWL_PATH = '/ipal/cookie-crawl'
export const COOKIE_CRAWL_RESULTS_PATH = '/ipal/cookie-crawl/results'
export const COOKIE_SCAN_URL_ENV = 'IAPL_COOKIE_SCAN_URL'
export const COOKIE_SCAN_TOKEN_ENV = 'IAPL_COOKIE_SCAN_TOKEN'
/** The variables' names before 1.17.0 — still read, and these constants keep their values. */
export const COOKIE_SCAN_URL_ENV = 'IPAL_COOKIE_SCAN_URL'
export const COOKIE_SCAN_TOKEN_ENV = 'IPAL_COOKIE_SCAN_TOKEN'
/** The names since 1.17.0; `readEnv(IAPL_COOKIE_SCAN_URL_ENV)` falls back to the old one. */
export const IAPL_COOKIE_SCAN_URL_ENV = 'IAPL_COOKIE_SCAN_URL'
export const IAPL_COOKIE_SCAN_TOKEN_ENV = 'IAPL_COOKIE_SCAN_TOKEN'
/** A crawl still "running" after this long is treated as lost (the service never called back). */
export const CRAWL_TIMEOUT_MS = 30 * 60_000
@@ -28,8 +32,8 @@ const trimSlash = (v: string) => v.replace(/\/+$/, '')
/** Options + env + Payload config, read at call time (env can change between deploys, not between requests). */
export function resolveCrawlConfig(options: CookieCrawlOptions, payload: BasePayload): ResolvedCrawlConfig {
const serviceUrl = options.serviceUrl ?? readEnv(COOKIE_SCAN_URL_ENV)?.trim()
const token = options.token ?? readEnv(COOKIE_SCAN_TOKEN_ENV)?.trim()
const serviceUrl = options.serviceUrl ?? readEnv(IAPL_COOKIE_SCAN_URL_ENV)?.trim()
const token = options.token ?? readEnv(IAPL_COOKIE_SCAN_TOKEN_ENV)?.trim()
const siteUrl = options.siteUrl ?? (payload.config.serverURL || process.env.NEXT_PUBLIC_SERVER_URL?.trim())
return {
acceptSelector: options.acceptSelector ?? '[data-ipal="accept"]',
@@ -11,9 +11,9 @@ import {
COOKIE_CRAWL_PATH,
COOKIE_CRAWL_RESULTS_PATH,
COOKIE_CRAWL_SLUG,
COOKIE_SCAN_TOKEN_ENV,
COOKIE_SCAN_URL_ENV,
CRAWL_TIMEOUT_MS,
IAPL_COOKIE_SCAN_TOKEN_ENV,
IAPL_COOKIE_SCAN_URL_ENV,
resolveCrawlConfig,
} from './config.js'
import { finishCrawl, ingestCrawlResult } from './ingest.js'
@@ -78,8 +78,8 @@ export function buildCookieCrawlEndpoints({
error: stale ? 'Timed out — the scanner service never reported back.' : (doc.error ?? null),
finishedAt: doc.finishedAt ?? null,
missing: [
...(config.serviceUrl ? [] : [COOKIE_SCAN_URL_ENV]),
...(config.token ? [] : [COOKIE_SCAN_TOKEN_ENV]),
...(config.serviceUrl ? [] : [IAPL_COOKIE_SCAN_URL_ENV]),
...(config.token ? [] : [IAPL_COOKIE_SCAN_TOKEN_ENV]),
...(config.siteUrl ? [] : ['serverURL / NEXT_PUBLIC_SERVER_URL']),
],
ok: true,
+2
View File
@@ -20,6 +20,8 @@ export {
COOKIE_CRAWL_SLUG,
COOKIE_SCAN_TOKEN_ENV,
COOKIE_SCAN_URL_ENV,
IAPL_COOKIE_SCAN_TOKEN_ENV,
IAPL_COOKIE_SCAN_URL_ENV,
resolveCrawlConfig,
} from './crawl/config.js'
export type { ResolvedCrawlConfig } from './crawl/config.js'
+1 -1
View File
@@ -79,7 +79,7 @@ export const agentRules: DoctorRule[] = [
plan.missing.length ? `missing ${plan.missing.join(', ')}` : '',
plan.retired.length ? `retired ${plan.retired.join(', ')}` : '',
].filter(Boolean)
return parts.length ? [{ file: dest, fix: 'pnpm exec iapl-skills and commit', message: `skills differ from the installed ipal-kit: ${parts.join('; ')}`, severity: 'warning' }] : []
return parts.length ? [{ file: dest, fix: 'pnpm exec iapl-skills and commit', message: `skills differ from the installed IAPL: ${parts.join('; ')}`, severity: 'warning' }] : []
},
docs: 'docs/agent/AGENT.md#14-skills-antigravity-claude-code-cursor',
group: 'agents',
+2 -1
View File
@@ -111,7 +111,8 @@ export const legacyRules: DoctorRule[] = [
const out: RuleFinding[] = []
for (const file of files) {
const code = stripComments(ctx.read(file))
if (!/<PageStats\b|<SiteProviders\s[^>]*\bstats\b/.test(code)) {continue}
// <SiteProviders … stats …>: a prop named stats anywhere after the tag opens (other props hold JSX, so the tag's end cannot be found by `>`)
if (!/<PageStats\b/.test(code) && !/<SiteProviders\b[\s\S]*?\sstats(?:\s*=|\s*\n|\s+[a-zA-Z/>])/.test(code)) {continue}
const set = /\bIAPL_VISITOR_COOKIE\b|['"]iapl_vid['"]/.test(code) ? 'iapl_vid' : /\bvisitorCookie\b/.test(code) ? null : 'ipal_vid'
if (set && set !== declared) {
out.push({
+6 -1
View File
@@ -1,3 +1,5 @@
import { legacyEnvName } from '../shared/envName.js'
/**
* Zero-dependency environment validation. The plugin deliberately does NOT pull
* in zod — forcing a validation library on every project would be a dependency
@@ -111,7 +113,10 @@ export function assertEnv(rules: EnvRule[], options: AssertEnvOptions = {}): voi
const problems: string[] = []
for (const rule of rules) {
const raw = [rule.name, ...(rule.aliases ?? [])].map((key) => env[key]).find((v) => typeof v === 'string' && v.trim() !== '')
// the name first, then the aliases — except that a plugin variable's IAPL_ spelling is read before its IPAL_ one,
// whichever of the two the rule is named after (ipalEnvRules names the old one)
const keys = [rule.name, ...(rule.aliases ?? [])].sort((a, b) => Number(b.startsWith('IAPL_') && legacyEnvName(b) === a) - Number(a.startsWith('IAPL_') && legacyEnvName(a) === b))
const raw = keys.map((key) => env[key]).find((v) => typeof v === 'string' && v.trim() !== '')
const value = typeof raw === 'string' ? raw.trim() : ''
const required = rule.required !== false
+29 -2
View File
@@ -2,6 +2,7 @@ import type { EnvRule } from './assertEnv.js'
type TurnstileNames = { secretVar?: string; siteKeyVar?: string }
import { ENV_PREFIX, LEGACY_ENV_PREFIX, legacyEnvName } from '../shared/envName.js'
import { checkDatabaseName } from './databaseName.js'
export type IaplEnvFeatures = {
@@ -200,8 +201,34 @@ export function iaplEnvRules(features: IaplEnvFeatures = {}): EnvRule[] {
return rules
}
/** @deprecated The name before 1.17.0; the same function as `iaplEnvRules`. Removed in 2.0. */
export const ipalEnvRules = iaplEnvRules
/**
* The rules as they were named before 1.17.0: the plugin's own variables are called `IPAL_<NAME>` here
* (with `IAPL_<NAME>` as the alias), so a project that adapts the list by name
* (`.map` / `.filter` on `rule.name`) finds the names it wrote. Everything else is `iaplEnvRules`.
* The value is the `IAPL_` one when both are set, as everywhere else.
* @deprecated Use `iaplEnvRules` (names `IAPL_<NAME>`, the old ones as aliases). Removed in 2.0.
*/
export function ipalEnvRules(features: IaplEnvFeatures = {}): EnvRule[] {
return iaplEnvRules(features).map((rule) => {
const old = legacyEnvName(rule.name)
if (!old) {return rule}
const { validate } = rule
return {
...rule,
name: old,
aliases: [rule.name],
...(rule.description ? { description: rule.description.replaceAll(ENV_PREFIX, LEGACY_ENV_PREFIX) } : {}),
...(validate
? {
validate: (value: string) => {
const result = validate(value)
return typeof result === 'string' ? result.replaceAll(ENV_PREFIX, LEGACY_ENV_PREFIX) : result
},
}
: {}),
}
})
}
/** @deprecated The name before 1.17.0; the same type as `IaplEnvFeatures`. Removed in 2.0. */
export type IpalEnvFeatures = IaplEnvFeatures
+5 -2
View File
@@ -8,9 +8,12 @@ import { readEnv } from '../shared/envName.js'
* Production never sets it — a forgotten staging copy indexed by Google is a
* duplicate of the real site.
*/
export const SITE_NOINDEX_ENV = 'IAPL_NOINDEX'
/** The variable's name before 1.17.0. Still read; kept under this constant so `process.env[SITE_NOINDEX_ENV]` in a project means what it meant. */
export const SITE_NOINDEX_ENV = 'IPAL_NOINDEX'
/** The variable's name since 1.17.0. Read it with `isSiteNoindex()` or `readEnv(IAPL_SITE_NOINDEX_ENV)`, which fall back to the old one. */
export const IAPL_SITE_NOINDEX_ENV = 'IAPL_NOINDEX'
export function isSiteNoindex(): boolean {
const v = readEnv(SITE_NOINDEX_ENV)?.trim().toLowerCase()
const v = readEnv(IAPL_SITE_NOINDEX_ENV)?.trim().toLowerCase()
return v === '1' || v === 'true' || v === 'yes'
}