#!/usr/bin/env node import { readFileSync } from "node:fs"; const expectedPackageName = "yedir-ai"; const governedFiles = [ "package.json", "README.md", "CHANGELOG.md", "SECURITY.md", "CONTRIBUTING.md", "SUPPORT.md", "CODE_OF_CONDUCT.md", ".env.example", "docs/architecture.md", "docs/deployment.md", "docs/operations.md", "docs/release-readiness.md", ".github/CODEOWNERS", ".github/PULL_REQUEST_TEMPLATE.md", ".github/dependabot.yml", ".github/ISSUE_TEMPLATE/bug_report.yml", ".github/ISSUE_TEMPLATE/config.yml", ".github/ISSUE_TEMPLATE/feature_request.yml", ".github/workflows/dependency-audit.yml", ".github/workflows/lint.yml", ".github/workflows/playwright.yml", ]; const forbiddenPatterns = [ { pattern: /\bai-chatbot\b/i, reason: "legacy package/repository name" }, { pattern: /chat-sdk\.dev/i, reason: "template documentation URL" }, { pattern: /Next\.js AI Chatbot/i, reason: "template project name" }, { pattern: /Chat SDK/i, reason: "template positioning" }, { pattern: /Deploy Your Own/i, reason: "template deployment copy" }, { pattern: /Vercel templates?/i, reason: "template marketplace copy" }, { pattern: /build:skip-prerender/i, reason: "build bypass script" }, { pattern: /Build fallback/i, reason: "build bypass output" }, { pattern: /next build --no-lint/i, reason: "build bypass command" }, ]; const violations = []; const packageJson = JSON.parse(readFileSync("package.json", "utf8")); if (packageJson.name !== expectedPackageName) { violations.push( `package.json: expected package name "${expectedPackageName}", received "${packageJson.name}"` ); } for (const file of governedFiles) { const source = readFileSync(file, "utf8"); const lines = source.split(/\r?\n/); lines.forEach((line, index) => { for (const { pattern, reason } of forbiddenPatterns) { if (pattern.test(line)) { violations.push(`${file}:${index + 1}: ${reason}: ${line.trim()}`); } } }); } if (violations.length > 0) { console.error("Brand hygiene check failed. Keep public delivery surfaces aligned with yedir-ai."); console.error(violations.join("\n")); process.exit(1); } console.log(`Brand hygiene check passed for ${governedFiles.length} files.`);