IAPL rename, scripted: preferred names in src, bin, scripts, services, tests; bin files and skill folders moved

Replaced by an explicit list of forms only (ten exported names, runtime env names, project file
names and marks, commands, skill names, the log prefix, the brand in prose). Package name, import
paths, routes, CSS tokens, data attributes, custom keys, context flags, the cookie and kv keys are
not touched. package.json keeps the five old bin names beside the five new ones.
The old names stop working in this commit and come back as aliases in the next; docs follow.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 17:24:21 +01:00
co-authored by Claude Fable 5.2
parent 414a4702df
commit 0a4f001797
262 changed files with 955 additions and 950 deletions
+14 -14
View File
@@ -160,15 +160,15 @@ export function canHoldStaffRole(collection: Staffish): boolean {
export type StaffAccountRules = { applied: string[]; ownRoles: boolean; slug?: string }
/**
* The "seen" marker (`custom.ipalAccounts`): which collection ipalKit handled, and whether as a staff
* The "seen" marker (`custom.ipalAccounts`): which collection iapl handled, and whether as a staff
* collection. Not a plain `true`: a later plugin may spread a collection into a new slug
* (`{ ...staff, slug: 'copy' }`) and the marker travels with it; and in `next dev` a collection object can
* outlive a reload in which it became staff.
*/
export type AccountsMarker = {
/**
* The operations that had a rule in the project's config when ipalKit ran (before Payload and the 2FA package
* filled the missing ones). A collection of the config that becomes staff LATER — a plugin listed after ipalKit
* The operations that had a rule in the project's config when iapl ran (before Payload and the 2FA package
* filled the missing ones). A collection of the config that becomes staff LATER — a plugin listed after iapl
* sets `admin.user` to it — keeps exactly those rules; an operation that had none gets the plugin's.
*/
own?: string[]
@@ -182,7 +182,7 @@ const markerOf = (collection: { custom?: unknown }): AccountsMarker | undefined
/**
* BOTH rules must allow: the plugin's and the one the collection already has. For a collection
* that arrives after ipalKit ran (a later plugin), whose config is already sanitized: Payload has
* that arrives after iapl ran (a later plugin), whose config is already sanitized: Payload has
* filled every missing rule with its default by then, and that default cannot be told from a
* rule somebody wrote — not by its name (a production build minifies it away) and not safely by
* identity. So nothing is guessed: the plugin's rule is put in FRONT of whatever is there. With
@@ -230,10 +230,10 @@ const bothAllowField =
* are involved.
*
* `mode`:
* - `'config'` (ipalKit is running, nothing is sanitized): an operation without a rule gets the plugin's;
* - `'config'` (iapl is running, nothing is sanitized): an operation without a rule gets the plugin's;
* - `'late'` (a staff collection a later plugin added; the config is sanitized, so Payload's default cannot be
* told from a written rule): the plugin's rule in front of every rule — except the operations named in `kept`:
* the collection was in the config when ipalKit ran and had a rule of the project's for them then (the marker's
* the collection was in the config when iapl ran and had a rule of the project's for them then (the marker's
* `own`), so they are left as a rule the project wrote, exactly as at config time;
* - `'copied'` (a late collection that is not staff, or that keeps its own rules — `custom.ipal.accountRules:
* false`): the plugin's rule goes in front ONLY of a rule the plugin wrote for another collection (its mark,
@@ -273,7 +273,7 @@ function ruleStaffCollection(collection: CollectionConfig, { create = true, plug
if (mark && mark.slug !== slug) {copied = true}
if (mode === 'config') {
if (there || !enabled) {continue} // a rule the project wrote
access[operation] = rule // marked when ipalKit finishes (markStaffRules): the 2FA package wraps it first
access[operation] = rule // marked when iapl finishes (markStaffRules): the 2FA package wraps it first
} else if ((mode === 'late' && enabled && !kept.includes(operation)) || mark) {
access[operation] = markedStaffRule(bothAllow(rule, there), slug)
} else {continue}
@@ -352,7 +352,7 @@ export function applyStaffAccountAccess(config: Config, staffSlugs: string[], op
collections: (config.collections ?? []).map((collection) => {
if (!collection.auth) {return collection}
// Which operations have a rule of the project's NOW — later nobody can tell (Payload and the 2FA package fill
// the missing ones). Kept in the marker for a collection that becomes staff after ipalKit ran.
// the missing ones). Kept in the marker for a collection that becomes staff after iapl ran.
const own = OPERATIONS.filter((operation) => Boolean((collection.access as Record<string, unknown> | undefined)?.[operation]))
if (!staffSlugs.includes(collection.slug)) {
return { ...collection, custom: { ...collection.custom, ipalAccounts: { slug: collection.slug, own, staff: false } satisfies AccountsMarker } }
@@ -370,14 +370,14 @@ export type LateAdoption = {
firstUser: boolean
/** The operations whose rule from the project's config was left as it is (a config collection that became staff later). */
kept: string[]
/** True when the collection was in the config when ipalKit ran (and became staff afterwards); false when a later plugin added it. */
/** True when the collection was in the config when iapl ran (and became staff afterwards); false when a later plugin added it. */
known: boolean
password: boolean
slug: string
}
/**
* Collections that were not in the config when ipalKit ran — a plugin listed after it added them.
* Collections that were not in the config when iapl ran — a plugin listed after it added them.
* Called when a config goes live (start, dev reload) with THAT config: a late STAFF collection
* gets the account rules (in front of whatever rules it has — `bothAllow`), the roles-field rule
* and the password hook; every late auth collection gets the first-user endpoint. Changes the
@@ -398,7 +398,7 @@ export function adoptLateAuthCollections(
// a copy; a marker that says "not staff" on a collection that is staff now was made before it was named as one.
const marker = markerOf(collection)
if (marker?.slug === collection.slug && (marker.staff || !staff)) {continue}
// In the config when ipalKit ran, not staff then (a later plugin made it the panel's): the rules it had then stay.
// In the config when iapl ran, not staff then (a later plugin made it the panel's): the rules it had then stay.
const known = marker?.slug === collection.slug
const kept = known && Array.isArray(marker.own) ? marker.own : []
const done: LateAdoption = { slug: collection.slug, applied: [], firstUser: false, kept: [], known, password: false }
@@ -429,7 +429,7 @@ export function adoptLateAuthCollections(
/**
* Puts the plugin's mark on the rules it filled in during this run (`custom.ipalAccountRules.applied`, for the
* collection's own slug). Called AFTER the 2FA package has wrapped them — the mark must be on the function that is
* on the collection — and BEFORE ipal-kit's own 2FA guard, which carries the mark to its wrapper. Already marked
* on the collection — and BEFORE IAPL's own 2FA guard, which carries the mark to its wrapper. Already marked
* functions are left, so it can run more than once.
*/
export function markStaffRules(config: Config): Config {
@@ -449,7 +449,7 @@ export function markStaffRules(config: Config): Config {
}
/**
* Marks the auth collections ipalKit has seen at config time — with their slug and whether they are staff — so
* Marks the auth collections iapl has seen at config time — with their slug and whether they are staff — so
* `adoptLateAuthCollections` leaves exactly those alone.
*/
export function markSeenAuthCollections(config: Config, staffSlugs: string[] = []): Config {
@@ -518,7 +518,7 @@ export function buildFirstUserEndpoint(option: FirstUserRouteOption = 'panel'):
export function applyFirstUserRoute(config: Config, option: FirstUserRouteOption = 'panel'): Config {
if (option === 'all') {return config}
if (option !== 'panel' && !Array.isArray(option)) {
throw new Error(`[ipal] accounts.firstUserRoute must be 'panel', 'all' or a list of collection slugs, got ${JSON.stringify(option)}.`)
throw new Error(`[iapl] accounts.firstUserRoute must be 'panel', 'all' or a list of collection slugs, got ${JSON.stringify(option)}.`)
}
return {
...config,