From bf41045a22e88dce2d05a16b4f11f81d1b26300e Mon Sep 17 00:00:00 2001 From: chrisjleal <184772742+chrisjleal@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:21:54 -0600 Subject: [PATCH] Move the copy check out of the public repo The copy rules run from the private workspace language gate, which already reads every docs page. The public repo keeps markdown and OpenAPI lint. Co-Authored-By: Claude Opus 5.5 --- package.json | 3 +- scripts/copy-gate-baseline.json | 88 ------------- scripts/copy-gate.mjs | 222 -------------------------------- 3 files changed, 1 insertion(+), 312 deletions(-) delete mode 100644 scripts/copy-gate-baseline.json delete mode 100644 scripts/copy-gate.mjs diff --git a/package.json b/package.json index 39df073..88875f4 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "dev": "npx --yes cross-env NODE_OPTIONS=--max-old-space-size=8192 npx --yes mint@4.2.108 dev", "lint:markdown": "npx --yes markdownlint-cli2@0.18.1 --config .markdownlint-cli2.jsonc", "lint:openapi": "npx --yes @redocly/cli@2.14.1 lint openapi/public-api.json", - "validate": "npm run lint:copy && npm run lint:markdown && npm run lint:openapi", - "lint:copy": "node scripts/copy-gate.mjs" + "validate": "npm run lint:markdown && npm run lint:openapi" } } diff --git a/scripts/copy-gate-baseline.json b/scripts/copy-gate-baseline.json deleted file mode 100644 index b8ca73c..0000000 --- a/scripts/copy-gate-baseline.json +++ /dev/null @@ -1,88 +0,0 @@ -[ - "api/authentication.mdx|separator|→ sign → . [signing format].", - "gates/checkout.mdx|separator|- : verifierid → qhash map (requires ). pass it as on so satisfied checks are not re-run.", - "mcp/verify-or-guide.mdx|separator|2. if satisfied → (continue silently)", - "mcp/verify-or-guide.mdx|separator|3. if not, and signed in for an instant verifier → (no hosted link)", - "mcp/verify-or-guide.mdx|separator|4. if not, and an outside login, payment, or different account is required → one hosted link", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|# proofable — authority-at-dispatch evidence", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|**protocol boundary:** authority → decision → dispatch → effect/outcome → receipt.", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|- — eight-case authority suite", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|- — ordered post-revocation probe", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|this is implementation evidence for the comparison in #13 — not aaif certification or wg", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|| binding veto / action outside delegated authority | **supported** — unauthorized execution is denied before executor assignment |", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|| remote authority status unavailable | **not applicable to current path** — proofable evaluates current authority state locally at dispatch and has no remote a", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|| revocation after dispatch | **supported** — the dispatch decision, the later revocation, the resulting effect/outcome, and the refusal of the next dispatch ar", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/README.md|separator|| revoked authority / stale grant | **supported** — revoked authority is denied while the never-revoked control remains accepted |", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/authority-effect-results.md|separator|# proofable — authority-at-dispatch results", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/authority-effect-results.md|separator|## revocation after dispatch — when the refusal happened, separately from the prior effect", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/authority-effect-results.md|separator|**authority → decision → dispatch → effect/outcome → receipt.** in proofable these are distinct", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/authority-effect-results.md|separator|- **pre-authorized fallback:** not applicable — the deployed path has no fallback authority, so silence never widens what the grant allows.", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/authority-effect-results.md|separator|- **trace:** recompute sha-256 of and compare against → .", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/authority-effect-results.md|separator|- sdk: (apache-2.0) · mcp: · docs:", - "public/evidence/aaif/authority-at-dispatch/2026-10-08-eight-case/authority-effect-results.md|separator|recorded times — dispatch , revocation", - "public/evidence/aaif/authority-at-dispatch/2026-10-24-served/README.md|provenance|## who ran it", - "public/evidence/aaif/authority-at-dispatch/2026-10-24-served/README.md|provenance|| who ran it | an ordinary, non-admin account on the public endpoint, with its own agent wallet and permission |", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/CORRECTION.md|separator|1. → states what grades: the authority", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/CORRECTION.md|separator|2. → no longer describes the earlier action as already", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/CORRECTION.md|separator|3. → the record carries", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/CORRECTION.md|separator|this directory corrects the packet at [ ] — .", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/CORRECTION.md|separator|| | — | this file | added |", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|# proofable — authority-at-dispatch evidence", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|**protocol boundary:** authority → decision → dispatch → effect/outcome → receipt.", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|- — eight-case authority suite", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|- — ordered post-revocation probe", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|this is implementation evidence for the comparison in #13 — not aaif certification or wg", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|| binding veto / action outside delegated authority | **supported** — unauthorized execution is denied before executor assignment |", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|| remote authority status unavailable | **not applicable to current path** — proofable evaluates current authority state locally at dispatch and has no remote a", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|| revocation after dispatch | **supported** — the dispatch decision, the later revocation, the resulting effect/outcome, and the refusal of the next dispatch ar", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/README.md|separator|| revoked authority / stale grant | **supported** — revoked authority is denied while the never-revoked control remains accepted |", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/authority-effect-results.md|separator|# proofable — authority-at-dispatch results", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/authority-effect-results.md|separator|## revocation after dispatch — when the refusal happened, separately from the prior effect", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/authority-effect-results.md|separator|**authority → decision → dispatch → effect/outcome → receipt.** in proofable these are distinct", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/authority-effect-results.md|separator|- **pre-authorized fallback:** not applicable — the deployed path has no fallback authority, so silence never widens what the grant allows.", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/authority-effect-results.md|separator|- **trace:** recompute sha-256 of and compare against → .", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/authority-effect-results.md|separator|- sdk: (apache-2.0) · mcp: · docs:", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite-c1/authority-effect-results.md|separator|recorded times — dispatch , revocation", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|# proofable — authority-at-dispatch evidence", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|**protocol boundary:** authority → decision → dispatch → effect/outcome → receipt.", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|- — eight-case authority suite", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|- — ordered post-revocation probe", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|this is implementation evidence for the comparison in #13 — not aaif certification or wg", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|| binding veto / action outside delegated authority | **supported** — unauthorized execution is denied before executor assignment |", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|| remote authority status unavailable | **not applicable to current path** — proofable evaluates current authority state locally at dispatch and has no remote a", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|| revocation after dispatch | **supported** — the dispatch decision, the later revocation, the resulting effect/outcome, and the refusal of the next dispatch ar", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/README.md|separator|| revoked authority / stale grant | **supported** — revoked authority is denied while the never-revoked control remains accepted |", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/authority-effect-results.md|separator|# proofable — authority-at-dispatch results", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/authority-effect-results.md|separator|## revocation after dispatch — when the refusal happened, separately from the prior effect", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/authority-effect-results.md|separator|**authority → decision → dispatch → effect/outcome → receipt.** in proofable these are distinct", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/authority-effect-results.md|separator|- **pre-authorized fallback:** not applicable — the deployed path has no fallback authority, so silence never widens what the grant allows.", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/authority-effect-results.md|separator|- **trace:** recompute sha-256 of and compare against → .", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/authority-effect-results.md|separator|- sdk: (apache-2.0) · mcp: · docs:", - "public/evidence/aaif/authority-at-dispatch/2026-11-01-suite/authority-effect-results.md|separator|recorded times — dispatch , revocation", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|# proofable — authority-at-dispatch evidence", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|**protocol boundary:** authority → decision → dispatch → effect/outcome → receipt.", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|- — eight-case authority suite", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|- — ordered post-revocation probe", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|this is implementation evidence for the comparison in #13 — not aaif certification or wg", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|| binding veto / action outside delegated authority | **supported** — unauthorized execution is denied before executor assignment |", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|| remote authority status unavailable | **not applicable to current path** — proofable evaluates current authority state locally at dispatch and has no remote a", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|| revocation after dispatch | **supported** — the dispatch decision, the later revocation, the resulting effect/outcome, and the refusal of the next dispatch ar", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/README.md|separator|| revoked authority / stale grant | **supported** — revoked authority is denied while the never-revoked control remains accepted |", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/authority-effect-results.md|separator|# proofable — authority-at-dispatch results", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/authority-effect-results.md|separator|## revocation after dispatch — when the refusal happened, separately from the prior effect", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/authority-effect-results.md|separator|**authority → decision → dispatch → effect/outcome → receipt.** in proofable these are distinct", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/authority-effect-results.md|separator|- **pre-authorized fallback:** not applicable — the deployed path has no fallback authority, so silence never widens what the grant allows.", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/authority-effect-results.md|separator|- **trace:** recompute sha-256 of and compare against → .", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/authority-effect-results.md|separator|- sdk: (apache-2.0) · mcp: · docs:", - "public/evidence/aaif/authority-at-dispatch/2026-11-02-suite/authority-effect-results.md|separator|recorded times — dispatch , revocation", - "public/evidence/aaif/authority-at-dispatch/README.md|separator|| [ ] | the same run as first published, retained and hash-pinned. corrected by — wording and grading scope only |", - "public/evidence/aaif/authority-at-dispatch/action/README.md|separator|# proofable trust harness — github action", - "public/evidence/aaif/authority-at-dispatch/action/README.md|separator|[profile → account → access keys]. the cases run hosted", - "public/evidence/aaif/authority-at-dispatch/action/README.md|separator|| | yes | — | access key from the account that pays for the run |", - "sdks/authentication.mdx|separator|for servers, ci, and mcp when browser sign-in is unavailable. create keys under [profile → account].", - "whitepaper.mdx|separator|**resolve → check → verify → evaluate → act or stop**", - "whitepaper.mdx|separator|a deployment can bind: **repository → artifact → environment → operation**", - "whitepaper.mdx|separator|a payment can bind: **amount → asset → destination → network**", - "whitepaper.mdx|separator|caip-380 uses caip-2 and caip-10 for chain and account identifiers [1–4]. signing follows the chain's native scheme. the envelope accepts any caip-2 namespace. ", - "whitepaper.mdx|separator|for people, that means completed verification does not need to reset at every application boundary. for agents, it creates a narrow and revocable path from **id" -] diff --git a/scripts/copy-gate.mjs b/scripts/copy-gate.mjs deleted file mode 100644 index 0a77ab8..0000000 --- a/scripts/copy-gate.mjs +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Public copy gate: mechanical slop tells in every reader-facing string. - * - * Mirror of the gate in proofable/neus (scripts/public-copy-tells.mjs). It blocks the tells a score should never - * have to catch: dated provenance and method narration, self-narration, the - * not-X-but-Y frame, decorative separators and arrows, stock AI wording, and hedges. - * A line with a tell is rewritten as its shortest outcome-first claim, with the - * source behind a link. - * - * Ratchet: findings that shipped before this gate sit in copy-gate-baseline.json - * and are worked down. Any finding not in the baseline fails, so every line that is - * added or changed is held to the gate. - * - * node scripts/copy-gate.mjs gate (fails on new findings) - * node scripts/public-prose-check.mjs --copy-report every live finding, by class - * node scripts/public-prose-check.mjs --copy-baseline rewrite the baseline (only after fixes) - */ -import fs from 'node:fs'; -import path from 'node:path'; - -const MONTH = '(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)'; - -export const TELLS = [ - { - id: 'provenance', - fix: 'Cut the date or method clause. State the outcome; the source goes behind a link.', - patterns: [ - /\b(?:scored|measured|captured|graded|judged|benchmarked) (?:by|on|at) (?:[A-Z]|\d)/, - new RegExp(`\\b(?:on|as of|since|dated) \\d{1,2} ${MONTH} \\d{4}\\b`, 'i'), - new RegExp(`\\bas of (?:${MONTH}|\\d{4}|today|this writing)\\b`, 'i'), - new RegExp(`\\b${MONTH} \\d{1,2}, \\d{4}\\b`), - /\bwho ran (?:it|them|each)\b/i, - /\bevery (?:row|number|result|figure) (?:names|says|cites|links)\b/i, - ], - }, - { - id: 'self-narration', - fix: 'Say the thing instead of announcing it.', - patterns: [ - /^(?:Below (?:are|is)|The following\b|Here(?:'s| is| are) (?:how|what|the|a)\b|In this (?:page|section)|This (?:page|section) (?:shows|lists|covers|explains|describes)|As shown)/i, - /\b(?:see|shown|listed|described) below\b/i, - /\bread on to\b/i, - ], - }, - { - id: 'not-x-but-y', - fix: 'State the positive claim once.', - patterns: [ - /\bnot (?:just|only|merely|simply)\b/i, - /\bisn['’]t (?:just|only)\b/i, - /\bnot (?:a|an|the) [a-z][^.,;!?]{0,40}[,;] (?:but|it['’]s)\b/i, - /, not (?:from|by|through|because|just|only|merely)\b/i, - ], - }, - { - id: 'separator', - fix: 'Use a period or a comma. No dashes, middle dots or arrows in reader copy.', - patterns: [/[—–·]/, /\s->\s/, /→/], - }, - { - id: 'ai-tell', - fix: 'Replace stock wording with the concrete verb or fact.', - patterns: [ - /\b(?:seamless(?:ly)?|leverag(?:e|es|ed|ing)|empower(?:s|ed|ing)?|robust|elevat(?:e|es|ing)|supercharg\w*|revolutioni[sz]\w*|next-generation|world-class|best-in-class|state-of-the-art|cutting-edge|game-?chang\w*|unleash\w*|streamlin\w*|holistic|synerg\w*|paradigm|ever-evolving|tapestry|testament to|embark\w*|in today['’]s)\b/i, - /\bharness(?:es|ing)? the\b/i, - /\bdelv(?:e|es|ing)\b/i, - /\beffortless(?:ly)?\b/i, - ], - }, - { - id: 'hedge', - fix: 'Make the claim directly or cut it.', - patterns: [ - /\b(?:helps? you|aims? to|is designed to|is able to|in order to|it['’]s worth noting|arguably|essentially|basically|simply put)\b/i, - ], - }, -]; - -const CODE_EXT = new Set(); -const TEXT_EXT = new Set(['.md', '.mdx', '.txt']); - -/** Every page and README a reader can open in this repository. */ -export const COPY_ROOTS = ['.']; -// Legal text is not rewritten by a style gate; a changelog's dates are its news. -const SKIP_DIR = new Set(['node_modules', '.git', '.github', 'openapi', 'images', 'fonts', 'scripts', 'legal']); -const SKIP_FILE = /^(?:changelog\.mdx|CHANGELOG\.md|CODE_OF_CONDUCT\.md|LICENSE|NOTICE)$/i; - -function walk(dir, out) { - if (!fs.existsSync(dir)) return out; - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - if (entry.isDirectory()) { - if (!SKIP_DIR.has(entry.name)) walk(path.join(dir, entry.name), out); - } else if (!SKIP_FILE.test(entry.name)) { - const ext = path.extname(entry.name); - if (CODE_EXT.has(ext) || TEXT_EXT.has(ext)) out.push(path.join(dir, entry.name)); - } - } - return out; -} - -function stripComments(code) { - return code - .replace(/\{\/\*[\s\S]*?\*\/\}/g, (m) => m.replace(/[^\n]/g, ' ')) - .replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, ' ')) - .replace(/(^|[^:'"`\\])\/\/[^\n]*/g, (m, lead) => lead + ' '.repeat(m.length - lead.length)); -} - -/** A string a person reads: words with spaces, not a class list, path, URL, selector or code. */ -function isReaderText(text) { - const t = text.trim(); - if (t.length < 12 || !/[A-Za-z]{3}/.test(t) || !/\s/.test(t)) return false; - if (/[{}<>=;]|=>|https?:|www\.|@\/|\/api\/|\$\{|\\n/.test(t)) return false; - if (/^[a-z0-9\-:/\[\]().%#!\s_]+$/.test(t) && /(?:^|\s)-?[a-z]+-[a-z0-9]/.test(t)) return false; // class lists - if (/^[\w.-]+(?:\s+[\w.-]+)*$/.test(t) && !/[A-Z]/.test(t) && t.split(/\s+/).length < 4) return false; - return true; -} - -function linesOf(text, index) { - return text.slice(0, index).split(/\r?\n/).length; -} - -function* readerStrings(file, raw) { - const ext = path.extname(file); - if (TEXT_EXT.has(ext)) { - const lines = raw.split(/\r?\n/); - let fence = false; - for (let i = 0; i < lines.length; i++) { - if (/^\s*```/.test(lines[i])) fence = !fence; - if (fence) continue; - const line = lines[i]; - // MDX component attributes and frontmatter carry titles and descriptions readers see. - for (const m of line.matchAll(/\b(?:title|description|alt|sidebarTitle|label)\s*[=:]\s*(["'])((?:(?!\1).)+)\1/g)) { - if (isReaderText(m[2])) yield { line: i + 1, text: m[2].trim() }; - } - const fm = line.match(/^(?:title|description|sidebarTitle):\s*(?!["'])(.+)$/); - if (fm && isReaderText(fm[1])) yield { line: i + 1, text: fm[1].trim() }; - const t = line - .replace(/`[^`]*`/g, ' ') - .replace(/\]\([^)]*\)/g, ']') - .replace(/<[^>]*>/g, ' ') - .replace(/\{[^}]*\}/g, ' '); - if (isReaderText(t)) yield { line: i + 1, text: t.replace(/\s+/g, ' ').trim() }; - } - return; - } - const code = stripComments(raw); - const literal = /(['"`])((?:\\.|(?!\1)[^\\\n])*)\1/g; - let m; - while ((m = literal.exec(code))) { - if (m[1] === '`' && m[2].includes('${')) continue; - if (isReaderText(m[2])) yield { line: linesOf(code, m.index), text: m[2].trim() }; - } - if (ext === '.tsx' || ext === '.jsx') { - const jsxText = />([^<>{}]+) re.test(text))) { - findings.push({ file: relFile, line, tell: tell.id, text: text.slice(0, 160) }); - } - } - } - } - } - return findings; -} - -export const fingerprint = (f) => `${f.file}|${f.tell}|${f.text.replace(/\s+/g, ' ').toLowerCase()}`; - -export function runCopyGate(root, argv) { - const baselinePath = path.join(root, 'scripts/copy-gate-baseline.json'); - const findings = scanCopyTells(root); - if (argv.includes('--copy-baseline')) { - const prints = [...new Set(findings.map(fingerprint))].sort(); - fs.writeFileSync(baselinePath, `${JSON.stringify(prints, null, 2)}\n`); - console.log(`public copy gate: baseline written with ${prints.length} finding(s)`); - return 0; - } - if (argv.includes('--copy-report')) { - const byTell = new Map(); - for (const f of findings) byTell.set(f.tell, [...(byTell.get(f.tell) || []), f]); - for (const tell of TELLS) { - const list = byTell.get(tell.id) || []; - console.log(`\n## ${tell.id} (${list.length}): ${tell.fix}`); - for (const f of list) console.log(`${f.file}:${f.line} ${f.text}`); - } - console.log(`\npublic copy gate: ${findings.length} live finding(s)`); - return 0; - } - const baseline = new Set(fs.existsSync(baselinePath) ? JSON.parse(fs.readFileSync(baselinePath, 'utf8')) : []); - const fresh = findings.filter((f) => !baseline.has(fingerprint(f))); - for (const f of fresh) { - const tell = TELLS.find((t) => t.id === f.tell); - console.error(`${f.file}:${f.line}: ${f.tell}: "${f.text}"\n ${tell.fix}`); - } - const live = new Set(findings.map(fingerprint)); - const cleared = [...baseline].filter((p) => !live.has(p)).length; - if (cleared) console.warn(`public copy gate: ${cleared} baseline finding(s) fixed; run --copy-baseline to drop them`); - console.warn(`public copy gate: ${baseline.size - cleared} known finding(s) left to fix (--copy-report lists them)`); - return fresh.length; -} - -import { fileURLToPath } from 'node:url'; - -if (path.resolve(process.argv[1] || '') === fileURLToPath(import.meta.url)) { - const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); - const argv = process.argv.slice(2); - const fresh = runCopyGate(root, argv); - if (fresh) { console.error(`copy gate: ${fresh} new finding(s)`); process.exit(1); } - if (!argv.length) console.log('copy gate: OK'); -}