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
+18 -18
View File
@@ -4,7 +4,7 @@ import { describe, expect, test, vi } from 'vitest'
import type { I18nConfig } from '../src/modules/i18n/types.js'
import { ipalKit } from '../src/plugin.js'
import { iapl } from '../src/plugin.js'
import { withTotpParts } from './helpers.js'
const i18n: I18nConfig = {
@@ -28,7 +28,7 @@ const run = (fn: Access | undefined, u: unknown) =>
describe('injected auth collection', () => {
test('with roles: a plain user can only see and edit itself, never create or delete', async () => {
const config = await ipalKit({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const config = await iapl({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const access = config.collections?.find((c) => c.slug === 'users')?.access ?? {}
expect(run(access.update, user)).toEqual({ id: { equals: 3 } })
@@ -45,7 +45,7 @@ describe('injected auth collection', () => {
test("the project's own auth collection keeps its own access", async () => {
const own = { slug: 'users', access: { read: () => true }, auth: true, fields: [] }
const config = await ipalKit({ access: { authCollection: 'users' }, i18n, twoFactor: false })(
const config = await iapl({ access: { authCollection: 'users' }, i18n, twoFactor: false })(
empty({ collections: [own] as CollectionConfig[] }),
)
const access = config.collections?.find((c) => c.slug === 'users')?.access
@@ -53,7 +53,7 @@ describe('injected auth collection', () => {
expect(access?.read).toBe(own.access.read)
// …and the account rules fill in only what it left out (accounts.*; `accounts: false` = nothing added)
expect(access?.admin).toBeTypeOf('function')
const untouched = await ipalKit({ access: { authCollection: 'users' }, accounts: false, i18n, twoFactor: false })(
const untouched = await iapl({ access: { authCollection: 'users' }, accounts: false, i18n, twoFactor: false })(
empty({ collections: [own] as CollectionConfig[] }),
)
expect(untouched.collections?.find((c) => c.slug === 'users')?.access).toBe(own.access)
@@ -65,7 +65,7 @@ describe('2FA wraps the auth collection people log in with', () => {
test('defaults to access.authCollection, not a literal "users"', async () => {
const plugin = totp()
await ipalKit({ access: { authCollection: 'admins' }, i18n, twoFactor: { issuer: 'A', plugin: plugin as never } })(
await iapl({ access: { authCollection: 'admins' }, i18n, twoFactor: { issuer: 'A', plugin: plugin as never } })(
empty(),
)
expect(plugin).toHaveBeenCalledWith(expect.objectContaining({ collection: 'admins' }))
@@ -73,7 +73,7 @@ describe('2FA wraps the auth collection people log in with', () => {
test('defaults to admin.user when access is not configured', async () => {
const plugin = totp()
await ipalKit({ i18n, twoFactor: { issuer: 'A', plugin: plugin as never } })(
await iapl({ i18n, twoFactor: { issuer: 'A', plugin: plugin as never } })(
empty({ admin: { user: 'staff' } } as Partial<Config>),
)
expect(plugin).toHaveBeenCalledWith(expect.objectContaining({ collection: 'staff' }))
@@ -91,20 +91,20 @@ describe('2FA wraps the auth collection people log in with', () => {
test('admin.user wins over access.authCollection as the default target', async () => {
const plugin = totp()
await ipalKit({ access: { authCollection: 'users' }, i18n, twoFactor: { issuer: 'A', plugin: plugin as never } })(twoAuth())
await iapl({ access: { authCollection: 'users' }, i18n, twoFactor: { issuer: 'A', plugin: plugin as never } })(twoAuth())
expect(plugin).toHaveBeenCalledWith(expect.objectContaining({ collection: 'admins' }))
})
test('a target other than the panel login collection fails at init…', async () => {
const plugin = totp()
await expect(
ipalKit({ i18n, twoFactor: { collectionSlug: 'users', issuer: 'A', plugin: plugin as never } })(twoAuth()),
iapl({ i18n, twoFactor: { collectionSlug: 'users', issuer: 'A', plugin: plugin as never } })(twoAuth()),
).rejects.toThrow(/admin panel logs in with "admins"/)
})
test('…unless allowCollectionMismatch says it is deliberate', async () => {
const plugin = totp()
await ipalKit({
await iapl({
i18n,
twoFactor: { allowCollectionMismatch: true, collectionSlug: 'users', issuer: 'A', plugin: plugin as never },
})(twoAuth())
@@ -114,7 +114,7 @@ describe('2FA wraps the auth collection people log in with', () => {
test('a target that is not an auth collection always fails', async () => {
const plugin = totp()
await expect(
ipalKit({
iapl({
i18n,
twoFactor: { allowCollectionMismatch: true, collectionSlug: 'pages', issuer: 'A', plugin: plugin as never },
})(twoAuth()),
@@ -124,7 +124,7 @@ describe('2FA wraps the auth collection people log in with', () => {
describe('globals: public read, editor+ write', () => {
test.each(['site-settings', 'cookie-settings', 'notifications'])('%s', async (slug) => {
const config = await ipalKit({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const config = await iapl({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const access = (config.globals?.find((g) => g.slug === slug) as GlobalConfig).access ?? {}
expect(run(access.read, null)).toBe(true)
expect(run(access.update, user)).toBe(false)
@@ -136,7 +136,7 @@ describe('globals: public read, editor+ write', () => {
describe('forms collection: public read, editor+ write, Emails hidden from plain users', () => {
const build = async () => {
const config = await ipalKit({ access: { authCollection: 'users' }, forms: {}, i18n, twoFactor: false })(empty())
const config = await iapl({ access: { authCollection: 'users' }, forms: {}, i18n, twoFactor: false })(empty())
return config.collections?.find((c) => c.slug === 'forms') as CollectionConfig
}
@@ -161,7 +161,7 @@ describe('forms collection: public read, editor+ write, Emails hidden from plain
describe('roles field: the first-register account becomes admin', () => {
const hook = async (totalDocs: number, value: string[], pathname = '/api/users/first-register') => {
const config = await ipalKit({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const config = await iapl({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const users = config.collections?.find((c) => c.slug === 'users') as CollectionConfig
const roles = users.fields.find((f) => 'name' in f && f.name === 'roles') as { hooks?: { beforeChange?: ((a: unknown) => unknown)[] } }
const count = vi.fn(async () => ({ totalDocs }))
@@ -188,12 +188,12 @@ describe('roles field: the first-register account becomes admin', () => {
describe('every access default can be overridden by the project', () => {
test('injected users: unlock is admin-only by default; access.authAccess keys win', async () => {
const base = await ipalKit({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const base = await iapl({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())
const def = base.collections?.find((c) => c.slug === 'users')?.access ?? {}
expect(run(def.unlock, user)).toBe(false)
expect(run(def.unlock, admin)).toBe(true)
const config = await ipalKit({
const config = await iapl({
access: { authAccess: { read: () => true }, authCollection: 'users' },
i18n,
twoFactor: false,
@@ -204,14 +204,14 @@ describe('every access default can be overridden by the project', () => {
})
test('access.firstUserAdmin: false keeps what the first-register form sent', async () => {
const config = await ipalKit({ access: { authCollection: 'users', firstUserAdmin: false }, i18n, twoFactor: false })(empty())
const config = await iapl({ access: { authCollection: 'users', firstUserAdmin: false }, i18n, twoFactor: false })(empty())
const users = config.collections?.find((c) => c.slug === 'users') as CollectionConfig
const roles = users.fields.find((f) => 'name' in f && f.name === 'roles') as { hooks?: unknown }
expect(roles.hooks).toBeUndefined()
})
test('globalOverrides: an object merges access (project wins), a function takes over', async () => {
const config = await ipalKit({
const config = await iapl({
access: { authCollection: 'users' },
globalOverrides: {
'cookie-settings': (g) => ({ ...g, label: 'Cookies' }),
@@ -229,7 +229,7 @@ describe('every access default can be overridden by the project', () => {
})
test('forms: formOverrides.access wins; a read rule on the Emails field wins', async () => {
const config = await ipalKit({
const config = await iapl({
access: { authCollection: 'users' },
forms: {
formOverrides: {