Starter: inherit the reference doctor silences and packageManager; cookieCrawl active in the reference
Same reference/package.json, reference/ipal-doctor.json and ci.yml env lines as claude/ipal-doctor-build, so the two branches merge cleanly there. ipal-doctor.json of a new site keeps i18n-literals (the /design styleguide) and audit:collections-present only while posts/caseStudies are in. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0dffb85ec1
commit
01afa6fab8
@@ -69,6 +69,9 @@ jobs:
|
||||
PAYLOAD_SECRET: ci-reference-secret-0123456789abcdef
|
||||
NEXT_PUBLIC_SERVER_URL: http://localhost:3100
|
||||
IPAL_IP_HEADER: x-forwarded-for
|
||||
# cookieScanner.crawl → ipalEnvRules({ cookieCrawl }) requires both in production; CI never starts a crawl
|
||||
IPAL_COOKIE_SCAN_URL: http://127.0.0.1:9/crawl
|
||||
IPAL_COOKIE_SCAN_TOKEN: ci-cookie-scan-token-0123456789
|
||||
NEXT_PUBLIC_TURNSTILE_SITE_KEY: 1x00000000000000000000AA
|
||||
TURNSTILE_SECRET_KEY: 1x0000000000000000000000000000000AA
|
||||
ALLOW_LOCAL_MEDIA: '1'
|
||||
|
||||
@@ -63,7 +63,20 @@ legacy-peer-deps=true
|
||||
```json
|
||||
{
|
||||
"domain": "example-studio.pl",
|
||||
"launched": false
|
||||
"launched": false,
|
||||
"rules": {
|
||||
"audit:collections-present": {
|
||||
"off": true,
|
||||
"reason": "Project decisions: posts and caseStudies with archive pages; entryFields.ts is their shared field helper, not a collection"
|
||||
},
|
||||
"i18n-literals": {
|
||||
"off": true,
|
||||
"files": [
|
||||
"src/components/design/**"
|
||||
],
|
||||
"reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -209,7 +222,7 @@ export function register() {
|
||||
assertEnv(
|
||||
ipalEnvRules({
|
||||
// @starter:if crawl
|
||||
//: cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN — the shared cookie-crawler service
|
||||
cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
|
||||
// @starter:endif
|
||||
databaseName: { domain: 'example-studio.pl' },
|
||||
// @starter:if graph
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** built (revision 3) — the user guide is [docs/project-starter.md](../project-starter.md). Differences from
|
||||
this design, found while building: the env rules stay inline in `instrumentation.ts` as in the reference site (no
|
||||
`src/env.rules.ts`); no `packageManager` field (the reference site has none — add it there and the starter copies it);
|
||||
`src/env.rules.ts`); `packageManager` comes from the reference site (added there for ipal-doctor's `pnpm-pinned`);
|
||||
the command needs `--config.auto-install-peers=false` to keep `dlx` small (7 packages instead of 356); the templates
|
||||
and the lockfile travel in one bundle (`dist/starter/template.json.gz`); the seed command is the reference's
|
||||
`SEED_ONLY=… pnpm seed`; the language answers are limited to default `pl` + `en` (the base seed is Polish + English).
|
||||
|
||||
@@ -109,7 +109,9 @@ pnpm exec ipal-kit create intecion.com --dir ../intecioncom-web --answers answer
|
||||
|
||||
The reference site's tree (AGENT.md §3) with: the plugin pinned to the exact released version, the database
|
||||
names from `databaseNamesFor(domain)` (`intecion.com` → `intecioncom_dev` / `intecioncom_prod`; hyphens stay),
|
||||
CSP in **report-only** (`ipal-doctor.json` silences the report-only finding for 28 days with the reason),
|
||||
`packageManager` pinned (copied from the reference site), CSP in **report-only** (`ipal-doctor.json` silences the
|
||||
report-only finding for 28 days with the reason, and carries the reference site's own reasoned silences —
|
||||
`i18n-literals` for the `/design` styleguide, `audit:collections-present` only while `posts` / `caseStudies` are in),
|
||||
`assertEnv(ipalEnvRules({ databaseName, ipHeader, storage, … }))` in `instrumentation.ts`, the blocks from the
|
||||
block library (`libraryBlocks` + `createBlockRegistry(content, { Image, Link, … })`), the design-token standard
|
||||
(`styles.css` imports only, the brand in `src/design/tokens.ts`, next/font `--font-family-body` /
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
{
|
||||
"domain": "example-studio.pl",
|
||||
"launched": false
|
||||
"launched": false,
|
||||
"rules": {
|
||||
"audit:collections-present": {
|
||||
"off": true,
|
||||
"reason": "Project decisions: posts and caseStudies with archive pages; entryFields.ts is their shared field helper, not a collection"
|
||||
},
|
||||
"i18n-literals": {
|
||||
"off": true,
|
||||
"files": [
|
||||
"src/components/design/**"
|
||||
],
|
||||
"reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"engines": {
|
||||
"node": ">=22 <23"
|
||||
},
|
||||
"packageManager": "[email protected]",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack",
|
||||
|
||||
@@ -9,7 +9,7 @@ export function register() {
|
||||
assertEnv(
|
||||
ipalEnvRules({
|
||||
// @starter:if crawl
|
||||
//: cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN — the shared cookie-crawler service
|
||||
cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
|
||||
// @starter:endif
|
||||
databaseName: { domain: 'example-studio.pl' },
|
||||
// @starter:if graph
|
||||
|
||||
@@ -175,11 +175,19 @@ export function renderAgentsMd(reference: string, a: StarterAnswers, ctx: SiteCo
|
||||
return header + reference.slice(rules, map) + siteMap + start + '\n' + renderDecisions(a, ctx) + reference.slice(to)
|
||||
}
|
||||
|
||||
/** ipal-doctor.json: the domain, not launched yet, and every deliberate difference silenced with its reason. */
|
||||
export function renderDoctorConfig(a: StarterAnswers, ctx: SiteContext): string {
|
||||
type DoctorRule = { [key: string]: unknown; off?: boolean; reason: string; until?: string }
|
||||
|
||||
/**
|
||||
* ipal-doctor.json: the domain, not launched yet, and every deliberate difference silenced with its reason —
|
||||
* the reference site's own silences (`inherited`, from its ipal-doctor.json) while the files they cover are in
|
||||
* the site, CSP report-only for 28 days, and each module the owner turned off.
|
||||
*/
|
||||
export function renderDoctorConfig(a: StarterAnswers, ctx: SiteContext, inherited: Record<string, DoctorRule> = {}): string {
|
||||
const until = new Date(`${ctx.date}T00:00:00Z`)
|
||||
until.setUTCDate(until.getUTCDate() + 28)
|
||||
const rules: Record<string, { off: true; reason: string; until?: string }> = {
|
||||
const kept = Object.entries(inherited).filter(([id]) => id !== 'audit:collections-present' || a.content.collections.length > 0)
|
||||
const rules: Record<string, DoctorRule> = {
|
||||
...Object.fromEntries(kept),
|
||||
csp: { off: true, reason: 'report-only at the start; switch to enforce once the [csp] reports are clean (security.md → ROLL OUT CSP)', until: until.toISOString().slice(0, 10) },
|
||||
}
|
||||
for (const skip of auditSkips(a)) {
|
||||
|
||||
@@ -18,9 +18,11 @@ import { fileRole } from './manifest.js'
|
||||
import { applyPlaceholders, applyVariants, leftoverFakes, type StarterFlags } from './text.js'
|
||||
|
||||
/** Files the starter writes from the answers; the manifest lists them under `generate`. */
|
||||
const GENERATORS: Record<string, (a: StarterAnswers, ctx: SiteContext) => string> = {
|
||||
type Generator = (a: StarterAnswers, ctx: SiteContext, reference: string | undefined) => string
|
||||
|
||||
const GENERATORS: Record<string, Generator> = {
|
||||
'DESIGN.md': (a) => renderDesignMd(a),
|
||||
'ipal-doctor.json': renderDoctorConfig,
|
||||
'ipal-doctor.json': (a, ctx, reference) => renderDoctorConfig(a, ctx, reference ? (JSON.parse(reference) as { rules?: Record<string, { reason: string }> }).rules : {}),
|
||||
'src/design/tokens.ts': (a) => renderTokens(a),
|
||||
'src/i18n.config.ts': (a) => renderI18nConfig(a),
|
||||
}
|
||||
@@ -83,7 +85,7 @@ export function renderSite(bundle: StarterBundle, a: StarterAnswers, ctx: SiteCo
|
||||
problems.push(`${path}: listed under "generate" but this ipal-kit has no generator for it`)
|
||||
continue
|
||||
}
|
||||
out[path] = generate(a, ctx)
|
||||
out[path] = generate(a, ctx, bundle.files[path])
|
||||
}
|
||||
if (problems.length) {throw new Error(`rendering the site:\n ${problems.join('\n ')}`)}
|
||||
out['pnpm-lock.yaml'] = bundle.lockfile
|
||||
|
||||
@@ -221,6 +221,9 @@ describe.runIf(existsSync(path.join(reference, 'starter.manifest.json')))('start
|
||||
expect(files['AGENTS.md']).toMatch(/## Project decisions\n- Languages: pl, en/)
|
||||
expect(files['src/seed/base.ts']).toContain("email: '[email protected]'")
|
||||
expect(files['pnpm-lock.yaml']).not.toContain('@intecion/ipal-kit')
|
||||
const doctor = JSON.parse(files['ipal-doctor.json'] ?? '') as { rules: Record<string, unknown> }
|
||||
expect(Object.keys(doctor.rules).sort()).toEqual(['audit:collections-present', 'csp', 'i18n-literals'])
|
||||
expect((JSON.parse(files['package.json'] ?? '') as { packageManager?: string }).packageManager).toMatch(/^pnpm@\d/)
|
||||
})
|
||||
|
||||
it('drops what the owner turned off', () => {
|
||||
@@ -239,5 +242,7 @@ describe.runIf(existsSync(path.join(reference, 'starter.manifest.json')))('start
|
||||
expect(files['src/instrumentation.ts']).toContain('storage: false,')
|
||||
expect(files['src/lib/content.ts']).not.toMatch(/buildLocalBusinessJsonLd|getPayload/)
|
||||
expect(files['AGENTS.md']).toContain('ipal-audit-skip: twofactor, r2')
|
||||
expect(Object.keys((JSON.parse(files['ipal-doctor.json'] ?? '') as { rules: object }).rules).sort()).toEqual(['2fa', 'csp', 'i18n-literals'])
|
||||
expect(files['src/instrumentation.ts']).not.toContain('cookieCrawl')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user