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
+15 -15
View File
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, test, vi } from 'vitest'
import { assertEnv } from '../src/modules/env/assertEnv.js'
import { checkDatabaseName, databaseNameFromUri, databaseNamesFor } from '../src/modules/env/databaseName.js'
import { ipalEnvRules } from '../src/modules/env/ipalEnvRules.js'
import { iaplEnvRules } from '../src/modules/env/iaplEnvRules.js'
const base = { DATABASE_URI: 'mongodb://db/x', NEXT_PUBLIC_SERVER_URL: 'http://localhost:3000', PAYLOAD_SECRET: 'a-long-random-test-secret-of-32-chars' }
const r2 = {
@@ -13,15 +13,15 @@ const r2 = {
R2_SECRET_ACCESS_KEY: 's',
}
function check(env: Record<string, string>, storage: NonNullable<Parameters<typeof ipalEnvRules>[0]>['storage'] = true) {
function check(env: Record<string, string>, storage: NonNullable<Parameters<typeof iaplEnvRules>[0]>['storage'] = true) {
vi.unstubAllEnvs()
for (const [k, v] of Object.entries(env)) {vi.stubEnv(k, v)}
return () => assertEnv(ipalEnvRules({ storage }), { env })
return () => assertEnv(iaplEnvRules({ storage }), { env })
}
afterEach(() => vi.unstubAllEnvs())
describe('ipalEnvRules({ storage })', () => {
describe('iaplEnvRules({ storage })', () => {
test('production: every R2_* is required', () => {
expect(check({ ...base, NODE_ENV: 'production' })).toThrow(/R2_BUCKET is required/)
expect(check({ ...base, ...r2, NODE_ENV: 'production' })).not.toThrow()
@@ -75,17 +75,17 @@ describe('database naming rule', () => {
expect(checkDatabaseName({ databaseUri: 'postgres://db/payload' })).toBeNull()
})
test('ipalEnvRules({ databaseName }) only warns — assertEnv still passes', () => {
test('iaplEnvRules({ databaseName }) only warns — assertEnv still passes', () => {
const warn = vi.fn()
const env = { DATABASE_URI: 'mongodb://mongo/payload', NEXT_PUBLIC_SERVER_URL: 'https://intecion.com', PAYLOAD_SECRET: 's' }
expect(() => assertEnv(ipalEnvRules({ databaseName: { domain: 'intecion.com', warn } }), { env })).not.toThrow()
expect(() => assertEnv(iaplEnvRules({ databaseName: { domain: 'intecion.com', warn } }), { env })).not.toThrow()
expect(warn).toHaveBeenCalledWith(expect.stringMatching(/DATABASE_URI: database "payload"[\s\S]*intecioncom_prod/))
warn.mockClear()
assertEnv(ipalEnvRules({ databaseName: { domain: 'www.intecion.com', warn } }), { env: { ...env, DATABASE_URI: 'mongodb://mongo/intecioncom_dev' } })
assertEnv(iaplEnvRules({ databaseName: { domain: 'www.intecion.com', warn } }), { env: { ...env, DATABASE_URI: 'mongodb://mongo/intecioncom_dev' } })
expect(warn).not.toHaveBeenCalled()
// true: the domain comes from NEXT_PUBLIC_SERVER_URL in process.env
vi.stubEnv('NEXT_PUBLIC_SERVER_URL', 'https://architektimprez.pl')
assertEnv(ipalEnvRules({ databaseName: { warn } }), { env: { ...env, DATABASE_URI: 'postgres://db/architektimprez_prod' } })
assertEnv(iaplEnvRules({ databaseName: { warn } }), { env: { ...env, DATABASE_URI: 'postgres://db/architektimprez_prod' } })
expect(warn).toHaveBeenCalledWith(expect.stringMatching(/expected "architektimprezpl_prod"/))
vi.unstubAllEnvs()
})
@@ -97,20 +97,20 @@ describe('PAYLOAD_SECRET minimum length', () => {
test('a short secret fails in production', () => {
vi.stubEnv('NODE_ENV', 'production')
expect(() => assertEnv(ipalEnvRules(), { env })).toThrow(/PAYLOAD_SECRET must be at least 32 characters in production \(got 12\)/)
expect(() => assertEnv(ipalEnvRules(), { env: { ...env, PAYLOAD_SECRET: 'x'.repeat(32) } })).not.toThrow()
expect(() => assertEnv(iaplEnvRules(), { env })).toThrow(/PAYLOAD_SECRET must be at least 32 characters in production \(got 12\)/)
expect(() => assertEnv(iaplEnvRules(), { env: { ...env, PAYLOAD_SECRET: 'x'.repeat(32) } })).not.toThrow()
})
test('a short secret passes outside production', () => {
vi.stubEnv('NODE_ENV', 'development')
expect(() => assertEnv(ipalEnvRules(), { env })).not.toThrow()
expect(() => assertEnv(iaplEnvRules(), { env })).not.toThrow()
})
test('secretMinLength: 0 turns the check off; a custom minimum is used', () => {
vi.stubEnv('NODE_ENV', 'production')
expect(() => assertEnv(ipalEnvRules({ secretMinLength: 0 }), { env })).not.toThrow()
expect(() => assertEnv(ipalEnvRules({ secretMinLength: 64 }), { env: { ...env, PAYLOAD_SECRET: 'x'.repeat(40) } })).toThrow(/at least 64 characters/)
expect(() => assertEnv(ipalEnvRules({ secretMinLength: 8 }), { env })).not.toThrow()
expect(() => assertEnv(ipalEnvRules({ secretVar: 'MY_SECRET' }), { env: { ...env, MY_SECRET: 'short' } })).toThrow(/MY_SECRET must be at least 32/)
expect(() => assertEnv(iaplEnvRules({ secretMinLength: 0 }), { env })).not.toThrow()
expect(() => assertEnv(iaplEnvRules({ secretMinLength: 64 }), { env: { ...env, PAYLOAD_SECRET: 'x'.repeat(40) } })).toThrow(/at least 64 characters/)
expect(() => assertEnv(iaplEnvRules({ secretMinLength: 8 }), { env })).not.toThrow()
expect(() => assertEnv(iaplEnvRules({ secretVar: 'MY_SECRET' }), { env: { ...env, MY_SECRET: 'short' } })).toThrow(/MY_SECRET must be at least 32/)
})
})