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:
co-authored by
Claude Fable 5.2
parent
414a4702df
commit
0a4f001797
+15
-15
@@ -39,7 +39,7 @@ export const doctorRules: DoctorRule[] = [
|
||||
...deepRules,
|
||||
]
|
||||
|
||||
/** `ipal-audit-skip` keys (AGENTS.md) → doctor rules they silence (the audit script honours the rest itself). */
|
||||
/** `iapl-audit-skip` keys (AGENTS.md) → doctor rules they silence (the audit script honours the rest itself). */
|
||||
export const AUDIT_SKIP_RULES: Record<string, string[]> = {
|
||||
csp: ['csp'],
|
||||
twofactor: ['2fa'],
|
||||
@@ -60,14 +60,14 @@ export type RunDoctorOptions = {
|
||||
/** The doctor's package root (bin/, docs/, dist/). */
|
||||
packageRoot: string
|
||||
root: string
|
||||
/** Extra rules (a project's own, `extraRules` in ipal-doctor.json are added too). */
|
||||
/** Extra rules (a project's own, `extraRules` in iapl-doctor.json are added too). */
|
||||
rules?: DoctorRule[]
|
||||
skip?: string[]
|
||||
staging?: boolean
|
||||
today?: string
|
||||
/** Live site; with IPAL_DOCTOR_TOKEN set (and no --deep) the deep rules read GET /api/ipal/doctor. */
|
||||
/** Live site; with IAPL_DOCTOR_TOKEN set (and no --deep) the deep rules read GET /api/ipal/doctor. */
|
||||
url?: string
|
||||
/** Store first-seen dates (CSP report-only) in ipal-doctor.json. Default: only outside CI. */
|
||||
/** Store first-seen dates (CSP report-only) in iapl-doctor.json. Default: only outside CI. */
|
||||
writeSeen?: boolean
|
||||
}
|
||||
|
||||
@@ -76,10 +76,10 @@ export function runDeepProbe(ctx: DoctorContext): DoctorStatus {
|
||||
const probe = join(ctx.packageRoot, 'dist/modules/doctor/probe.js')
|
||||
if (!existsSync(probe)) {return { error: `the probe is missing (${probe}) — build the plugin` }}
|
||||
const res = run('pnpm', ['exec', 'payload', 'run', probe], ctx.root, 300_000)
|
||||
const line = res.stdout.split('\n').find((l) => l.startsWith('IPAL_DOCTOR_STATUS '))
|
||||
const line = res.stdout.split('\n').find((l) => l.startsWith('IAPL_DOCTOR_STATUS '))
|
||||
if (!line) {return { error: `payload run gave no status (exit ${res.code}): ${(res.stderr || res.stdout).trim().split('\n').slice(-1)[0] ?? ''}` }}
|
||||
try {
|
||||
return JSON.parse(line.slice('IPAL_DOCTOR_STATUS '.length)) as DoctorStatus
|
||||
return JSON.parse(line.slice('IAPL_DOCTOR_STATUS '.length)) as DoctorStatus
|
||||
} catch {
|
||||
return { error: 'payload run printed an unreadable status' }
|
||||
}
|
||||
@@ -105,19 +105,19 @@ export function globToRegExp(glob: string): RegExp {
|
||||
|
||||
const inFiles = (file: string | undefined, globs: string[] | undefined) => !globs?.length || (!!file && globs.some((g) => globToRegExp(g).test(file)))
|
||||
|
||||
/** Applies ipal-doctor.json `rules` and `ipal-audit-skip` lines: off (silenced, kept in JSON), severity, until. */
|
||||
/** Applies iapl-doctor.json `rules` and `iapl-audit-skip` lines: off (silenced, kept in JSON), severity, until. */
|
||||
export function applySettings(findings: DoctorFinding[], ctx: DoctorContext): DoctorFinding[] {
|
||||
const settings = ctx.config.rules ?? {}
|
||||
const out: DoctorFinding[] = []
|
||||
for (const [id, s] of Object.entries(settings)) {
|
||||
if (!s || typeof s !== 'object') {continue}
|
||||
if (!s.reason?.trim()) {out.push({ fix: 'add "reason": "<why>" — an entry without one is ignored', message: `ipal-doctor.json: rule "${id}" has no reason, so it is ignored`, rule: 'doctor-config', severity: 'error', source: 'static' })}
|
||||
else if (s.severity && !SEVERITIES.includes(s.severity)) {out.push({ message: `ipal-doctor.json: rule "${id}" has an unknown severity "${s.severity}"`, rule: 'doctor-config', severity: 'error', source: 'static' })}
|
||||
else if (s.until && ctx.today > s.until) {out.push({ fix: 'fix the finding, or extend "until" with a new reason', message: `ipal-doctor.json: the setting for "${id}" expired on ${s.until}`, rule: 'doctor-config', severity: 'warning', source: 'static' })}
|
||||
if (!s.reason?.trim()) {out.push({ fix: 'add "reason": "<why>" — an entry without one is ignored', message: `iapl-doctor.json: rule "${id}" has no reason, so it is ignored`, rule: 'doctor-config', severity: 'error', source: 'static' })}
|
||||
else if (s.severity && !SEVERITIES.includes(s.severity)) {out.push({ message: `iapl-doctor.json: rule "${id}" has an unknown severity "${s.severity}"`, rule: 'doctor-config', severity: 'error', source: 'static' })}
|
||||
else if (s.until && ctx.today > s.until) {out.push({ fix: 'fix the finding, or extend "until" with a new reason', message: `iapl-doctor.json: the setting for "${id}" expired on ${s.until}`, rule: 'doctor-config', severity: 'warning', source: 'static' })}
|
||||
}
|
||||
const skips = new Map<string, string>()
|
||||
for (const [key, reason] of ctx.auditSkips) {
|
||||
for (const id of AUDIT_SKIP_RULES[key] ?? []) {skips.set(id, reason || `ipal-audit-skip: ${key}`)}
|
||||
for (const id of AUDIT_SKIP_RULES[key] ?? []) {skips.set(id, reason || `iapl-audit-skip: ${key}`)}
|
||||
}
|
||||
for (const f of findings) {
|
||||
const s = settings[f.rule] ?? settings[f.rule.split(':')[0]]
|
||||
@@ -152,8 +152,8 @@ export async function runDoctor(options: RunDoctorOptions): Promise<DoctorReport
|
||||
const live = options.url ? createLiveFetcher(options.url, { adminRoute: options.adminRoute, staging: options.staging }) : null
|
||||
const ctx = createDoctorContext({ config: options.config, envFile: options.envFile, live, offline: options.offline, packageRoot: options.packageRoot, root, today: options.today })
|
||||
|
||||
// Deep status: the probe (--deep), the endpoint (--url + IPAL_DOCTOR_TOKEN), or none.
|
||||
const token = process.env.IPAL_DOCTOR_TOKEN?.trim()
|
||||
// Deep status: the probe (--deep), the endpoint (--url + IAPL_DOCTOR_TOKEN), or none.
|
||||
const token = process.env.IAPL_DOCTOR_TOKEN?.trim()
|
||||
if (options.deepStatus !== undefined) {ctx.deep = options.deepStatus}
|
||||
else if (options.deep) {ctx.deep = runDeepProbe({ ...ctx, root })}
|
||||
else if (options.url && token && token.length >= 32) {ctx.deep = await fetchDeepStatus(options.url, token)}
|
||||
@@ -182,9 +182,9 @@ export async function runDoctor(options: RunDoctorOptions): Promise<DoctorReport
|
||||
|
||||
// First-seen dates (CSP report-only → warning after 4 weeks): stored outside CI when the file exists.
|
||||
const writeSeen = options.writeSeen ?? !process.env.CI
|
||||
if (writeSeen && findings.some((f) => f.rule === 'csp' && /report-only/.test(f.message)) && !ctx.config.seen?.['csp-report-only'] && existsSync(join(root, 'ipal-doctor.json'))) {
|
||||
if (writeSeen && findings.some((f) => f.rule === 'csp' && /report-only/.test(f.message)) && !ctx.config.seen?.['csp-report-only'] && existsSync(join(root, 'iapl-doctor.json'))) {
|
||||
const current = loadDoctorConfig(root).config
|
||||
writeFileSync(join(root, 'ipal-doctor.json'), `${JSON.stringify({ ...current, seen: { ...current.seen, 'csp-report-only': ctx.today } }, null, 2)}\n`)
|
||||
writeFileSync(join(root, 'iapl-doctor.json'), `${JSON.stringify({ ...current, seen: { ...current.seen, 'csp-report-only': ctx.today } }, null, 2)}\n`)
|
||||
}
|
||||
|
||||
const final = applySettings(findings, ctx).sort((a, b) => Number(!!a.silenced) - Number(!!b.silenced) || RANK[a.severity] - RANK[b.severity])
|
||||
|
||||
Reference in New Issue
Block a user