ipal-doctor: find the frontend route group by structure, accept notFoundView.tsx
layout-required no longer assumes src/app/(frontend): any app/(<group>) (or app itself) holding the catch-all page is the frontend, a localized one first; two candidates give a warning naming both. notFoundView.ts or .tsx, and the usual extensions for the other required files. New ipal-doctor.json layout.frontend override and export findFrontend. Reported by Say Diamonds (1.15.1, route group (site)). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a515bd6851
commit
b80770bc2e
@@ -8,6 +8,21 @@ versions at once, go through every "Requires project changes" section in order,
|
||||
version you have. A new release = a new section at the top; we remove the oldest ones only
|
||||
once there are more than 20.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
- **ipal-doctor finds the frontend by structure, not by the name `(frontend)`.** A site with its pages in another route
|
||||
group (`src/app/(site)/[locale]`) was treated as single-language: false "missing" routes and a demand for the
|
||||
single-language Markdown route. `layout-required` now takes any `app/(<group>)` (or `app` itself) that holds the
|
||||
catch-all page, a localized one first; two candidates give a warning naming both. The lazy 404's server action may be
|
||||
`notFoundView.ts` or `notFoundView.tsx` (pages.md), and the other required files accept their usual extensions
|
||||
(`.ts`/`.tsx`, route `.js`). New: `ipal-doctor.json` `"layout": { "frontend": "src/app/(site)" }` for a layout the
|
||||
doctor cannot tell; new export `findFrontend`.
|
||||
|
||||
### What projects must update
|
||||
- Nothing. After upgrading, drop any temporary `layout-required` silence in `ipal-doctor.json` that was added for a
|
||||
route group with another name or a `notFoundView.tsx`, and run `pnpm exec ipal-doctor` again.
|
||||
|
||||
## 1.15.1
|
||||
|
||||
A seed run that stops early now fails loudly instead of looking like a success.
|
||||
|
||||
+1
-1
@@ -422,7 +422,7 @@ CDN preconnect: `<MediaPreconnect />` (from env). Media: `normalizeFilenameHook`
|
||||
```
|
||||
src/
|
||||
app/
|
||||
(frontend)/
|
||||
(frontend)/ # any route group name works ((site) …); ipal-doctor finds it by structure
|
||||
styles.css # Tailwind + @source on node_modules/@intecion/ipal-kit/dist
|
||||
[locale]/ # single-language: no [locale] (see i18n.md)
|
||||
layout.tsx # no <head>; <SiteProviders shell={await getSiteShell(locale)}> + Header/Footer
|
||||
|
||||
@@ -27,7 +27,8 @@ Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
|
||||
{ "rules": { "i18n-literals": { "off": true, "files": ["src/components/design/**"], "reason": "approved exception: styleguide labels" } } }
|
||||
```
|
||||
Keys: `off`, `severity`, `reason` (required), `until` (ISO date), `files` (globs). Top level: `domain`, `launched`,
|
||||
`layout.allow`, `seen` (written by the doctor), `extraRules`.
|
||||
`layout.allow`, `layout.frontend` (the pages' folder, e.g. `src/app/(site)` — found by structure otherwise; any route
|
||||
group name works), `seen` (written by the doctor), `extraRules`.
|
||||
5. Run again until it reports what the project expects (a new site: `--strict` → `0 error(s), 0 warning(s), 0 info`).
|
||||
|
||||
## Options and exit codes
|
||||
|
||||
@@ -144,7 +144,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
|
||||
## 3. What the project wires itself
|
||||
|
||||
Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ipal-seo-check**, **ipal-doctor** (`pnpm exec ipal-doctor` — the whole site against the team standard; `ipal-doctor.json` silences a rule with a reason, docs/doctor.md).
|
||||
Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ipal-seo-check**, **ipal-doctor** (`pnpm exec ipal-doctor` — the whole site against the team standard; `ipal-doctor.json` silences a rule with a reason; the pages may sit in any route group — `layout.frontend` names it when two qualify; docs/doctor.md).
|
||||
`$U` = `NEXT_PUBLIC_SERVER_URL` (e.g. `http://localhost:3000`).
|
||||
|
||||
| element | file | minimal example | how to check | details |
|
||||
|
||||
@@ -810,13 +810,14 @@ Bin: `ipal-doctor` (`pnpm exec ipal-doctor [dir] [--json] [--md] [--strict] [--f
|
||||
| `planSkills({ dest, source })` | `@intecion/ipal-kit/doctor` | What `ipal-skills` would change: `missing`, `stale`, `retired` ipal-* folders. |
|
||||
| `parseToolOutput(text)`, `AUDIT_RULE_MAP` | `@intecion/ipal-kit/doctor` | Reads `[ERROR] title (n) — rule` output of `audit.sh` / `seo-check.mjs`; audit titles that are a doctor rule. |
|
||||
| `DEFAULT_SRC_ALLOW` | `@intecion/ipal-kit/doctor` | Top-level `src/` entries the convention allows (`layout.allow` extends it). |
|
||||
| `findFrontend(ctx)` | `@intecion/ipal-kit/doctor` | The folder of the site's pages (`FrontendLayout`: `dir`, `multi`, `ambiguous`, `missingOverride`) — found by structure (any route group with the catch-all page, a localized one first); `layout.frontend` in `ipal-doctor.json` wins. |
|
||||
| `createLiveFetcher(url, { adminRoute, staging })` | `@intecion/ipal-kit/doctor` | Cached GET-only fetcher for the live rules. |
|
||||
| `runDeepProbe(ctx)` | `@intecion/ipal-kit/doctor` | `pnpm exec payload run …/dist/modules/doctor/probe.js` in the project → `DoctorStatus`. |
|
||||
| `collectDoctorStatus(payload)` | `@intecion/ipal-kit/doctor` | Read-only counts: `usersWithout2fa`, `pendingCookies`, `plugin`, `node`. |
|
||||
| `buildDoctorEndpoint({ tokenVar, access })` | `@intecion/ipal-kit/doctor` | `GET /ipal/doctor` (`/api/ipal/doctor`): 404 until the token variable (default `IPAL_DOCTOR_TOKEN`, ≥ 32 chars) is set, Bearer token or `access`, rate-limited. Added by `ipalKit` unless `doctor: false`. |
|
||||
|
||||
**Types:** `DoctorRule`, `DoctorFinding`, `RuleFinding`, `DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`,
|
||||
`DoctorSource`, `DoctorStatus`, `DoctorContext`, `RunDoctorOptions`, `DoctorEndpointOptions`.
|
||||
`DoctorSource`, `DoctorStatus`, `DoctorContext`, `RunDoctorOptions`, `DoctorEndpointOptions`, `FrontendLayout`.
|
||||
|
||||
## Turnstile (`turnstile`) — details: `node_modules/@intecion/ipal-kit/docs/turnstile.md`
|
||||
|
||||
|
||||
+5
-4
@@ -84,7 +84,7 @@ Turn off: `ipalKit({ doctor: false })`. Adapt: `ipalKit({ doctor: { tokenVar: 'M
|
||||
| | `node-22` | warning | `engines.node` only 22 (`">=22 <23"`), `.nvmrc` / `.node-version` = 22; with `--deep`, the running Node |
|
||||
| | `pnpm-pinned` | info | `packageManager` is set |
|
||||
| | `deps-audit` | error on critical/high, info on moderate/low | `pnpm audit --prod` (registry) |
|
||||
| layout | `layout-required` | error | the AGENT.md §3 files (proxy, i18n config, instrumentation, `lib/content`, every route, the `(frontend)` files, `blocks/registry.ts`, `collections/{Pages,Media}.ts`, `components/layout`, `components/forms/formClasses.ts`); an `ipal-audit-skip` key (`llms`, `llms-full`, `markdown`, `mcp`, `indexnow`) drops its file |
|
||||
| layout | `layout-required` | error | the AGENT.md §3 files (proxy, i18n config, instrumentation, `lib/content`, every route, the frontend files — `layout`, `actions`, `not-found`, `notFoundView` (`.ts` or `.tsx`), the catch-all page — in the route group found by structure: any `app/(<group>)` (or `app` itself) holding `[locale]/[[...slug]]/page.tsx` or `[[...slug]]/page.tsx`, a localized one first, `(frontend)` on a tie (two matches → a warning naming both); `layout.frontend` sets it, `blocks/registry.ts`, `collections/{Pages,Media}.ts`, `components/layout`, `components/forms/formClasses.ts`); an `ipal-audit-skip` key (`llms`, `llms-full`, `markdown`, `mcp`, `indexnow`) drops its file |
|
||||
| | `layout-forbidden` | error | no `middleware.ts`, no `lib/{pages,locales,navigation}.ts`, `fields/{link,sectionHeader,sectionSettings}.ts` |
|
||||
| | `layout-extra` | info | `src/` entries outside the allow list (AGENT.md §3 + `seed/`, `design/`, `db.ts`, `env.rules.ts`, `content.config.ts`; extend with `layout.allow`) |
|
||||
| | `naming` | warning | block folders, collection and global files PascalCase, `scripts/*` kebab-case, no `index.ts` barrels |
|
||||
@@ -128,7 +128,7 @@ Every rule can be silenced, lowered or raised — **with a reason** — in `ipal
|
||||
{
|
||||
"domain": "example-studio.pl",
|
||||
"launched": false,
|
||||
"layout": { "allow": ["scripts"] },
|
||||
"layout": { "allow": ["scripts"], "frontend": "src/app/(site)" },
|
||||
"rules": {
|
||||
"csp": { "off": true, "reason": "new site: report-only until the reports are clean", "until": "2026-12-01" },
|
||||
"i18n-literals": { "off": true, "files": ["src/components/design/**"], "reason": "approved exception: the styleguide labels" },
|
||||
@@ -144,6 +144,7 @@ Every rule can be silenced, lowered or raised — **with a reason** — in `ipal
|
||||
| `domain` | the production domain (dots allowed) — the base of the database names. Without it: a non-local `NEXT_PUBLIC_SERVER_URL`, else the folder name minus `-web` |
|
||||
| `launched` | the site is live: seeds must then name their records. Also true when "Project decisions" has a line with "launch" and a date |
|
||||
| `layout.allow` | more top-level `src/` entries the convention allows |
|
||||
| `layout.frontend` | the folder that holds the site's pages, e.g. `src/app/(site)` — only for a layout the doctor cannot tell (two route groups with pages); the route group's name is otherwise free |
|
||||
| `rules.<id>` | `off` (silence), `severity` (`error` / `warning` / `info`), `reason` (**required** — an entry without one is ignored and reported), `until` (ISO date; after it the entry stops applying and the report says so), `files` (globs: only findings in those files). The id is the rule (`csp`) or an audit finding (`audit:collections-present`); `audit` covers all audit findings |
|
||||
| `seen` | first-seen dates the doctor stores itself (`csp-report-only`, for the 4-week CSP rule). It writes this key only outside CI (`CI` unset), not with `--json`, and only when the file exists |
|
||||
| `extraRules` | your own rule modules (paths relative to the project), each exporting `rules: DoctorRule[]` |
|
||||
@@ -199,10 +200,10 @@ console.log(formatReport(report))
|
||||
|
||||
`runDoctor`, `runDoctorCli`, `doctorRules`, `applySettings`, `runDeepProbe`, `createDoctorContext`, `loadDoctorConfig`,
|
||||
`formatReport`, `formatDriftTable`, `planSkills`, `parseToolOutput`, `AUDIT_RULE_MAP`, `AUDIT_SKIP_RULES`,
|
||||
`DEFAULT_SRC_ALLOW`, `createLiveFetcher`, `buildDoctorEndpoint`, `collectDoctorStatus`, `globToRegExp`, `parseEnvFile`,
|
||||
`DEFAULT_SRC_ALLOW`, `findFrontend`, `createLiveFetcher`, `buildDoctorEndpoint`, `collectDoctorStatus`, `globToRegExp`, `parseEnvFile`,
|
||||
`readAuditSkips`, `bareHost`, `expandSites`, `parseDoctorArgs`, `DOCTOR_USAGE`; types `DoctorRule`, `DoctorFinding`,
|
||||
`DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`, `DoctorSource`, `DoctorStatus`, `DoctorContext`,
|
||||
`RuleFinding`, `RunDoctorOptions`, `DoctorEndpointOptions`.
|
||||
`RuleFinding`, `RunDoctorOptions`, `DoctorEndpointOptions`, `FrontendLayout`.
|
||||
|
||||
## Environment variables
|
||||
|
||||
|
||||
Reference in New Issue
Block a user