@pas7/llm-seo 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/exit-codes.ts","../../src/schema/config.schema.ts","../../src/cli/io/fs.ts","../../src/cli/io/load-config.ts","../../src/cli/io/report.ts","../../src/core/normalize/url.ts","../../src/core/normalize/sort.ts","../../src/core/normalize/text.ts","../../src/core/canonical/locale.ts","../../src/core/canonical/canonical-from-manifest.ts","../../src/core/generate/llms-txt.ts","../../src/core/generate/llms-full-txt.ts","../../src/core/generate/citations.ts","../../src/core/check/issues.ts","../../src/core/check/rules-linter.ts","../../src/core/check/checker.ts","../../src/core/index.ts","../../src/cli/commands/generate.ts","../../src/cli/commands/check.ts","../../src/cli/commands/doctor.ts","../../src/cli/bin.ts"],"names":["getHubLabel","formatHubLabel","extractManifestItems","toManifestItem","generateCommand","checkCommand","doctorCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IASa,SAAA;AATb,IAAA,eAAA,GAAA,KAAA,CAAA;AAAA,EAAA,uBAAA,GAAA;AASO,IAAM,SAAA,GAAY;AAAA;AAAA,MAEvB,EAAA,EAAI,CAAA;AAAA;AAAA,MAEJ,IAAA,EAAM,CAAA;AAAA;AAAA,MAEN,KAAA,EAAO,CAAA;AAAA;AAAA,MAEP,aAAA,EAAe,CAAA;AAAA;AAAA,MAEf,gBAAA,EAAkB,CAAA;AAAA;AAAA,MAElB,cAAA,EAAgB,CAAA;AAAA;AAAA,MAEhB,cAAA,EAAgB,CAAA;AAAA;AAAA,MAEhB,iBAAA,EAAmB,CAAA;AAAA;AAAA,MAEnB,iBAAA,EAAmB,CAAA;AAAA;AAAA,MAEnB,iBAAA,EAAmB,GAAA;AAAA;AAAA,MAEnB,iBAAA,EAAmB;AAAA,KACrB;AAAA,EAAA;AAAA,CAAA,CAAA;AChCA,IAUa,gBAAA,CAAA,CAqBA,iBAAA,CA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AM,mEAAA,EAAqE,OAAA,CAAQ,IAAA,CAAK,IAAA,CAAK,GAAG,CAAC,CAAA;AACzG,EAAA,OAAA,CAAQ,IAAA,CAAK,UAAU,iBAAiB,CAAA;AAC1C,CAAC,CAAA;AAGD,OAAA,CAAQ,KAAA,CAAM,QAAQ,IAAI,CAAA;AAG1B,IAAI,CAAC,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,CAAC,EAAE,MAAA,EAAQ;AACjC,EAAA,OAAA,CAAQ,UAAA,EAAW;AACrB","file":"bin.js","sourcesContent":["/**\n * Exit codes for CLI commands.\n */\n\nimport type { CheckIssue, IssueSeverity } from '../core/check/issues.js';\n\n/**\n * Exit codes for the llm-seo CLI.\n */\nexport const ExitCodes = {\n /** Command completed successfully */\n OK: 0,\n /** Warnings found (when --fail-on warn) */\n WARN: 1,\n /** Errors found */\n ERROR: 2,\n /** Network error (for doctor command) */\n NETWORK_ERROR: 3,\n /** Configuration file not found */\n CONFIG_NOT_FOUND: 4,\n /** Invalid configuration */\n INVALID_CONFIG: 5,\n /** File not found */\n FILE_NOT_FOUND: 6,\n /** Validation failed */\n VALIDATION_FAILED: 7,\n /** Generation failed */\n GENERATION_FAILED: 8,\n /** Permission denied */\n PERMISSION_DENIED: 126,\n /** Command not found */\n COMMAND_NOT_FOUND: 127,\n} as const;\n\n/**\n * Type for exit codes.\n */\nexport type ExitCode = (typeof ExitCodes)[keyof typeof ExitCodes];\n\n/**\n * Exits the process with the given code.\n * @param code - Exit code\n */\nexport function exit(code: ExitCode): never {\n process.exit(code);\n}\n\n/**\n * Determines exit code from issues array.\n * @param issues - Array of check issues\n * @param failOn - Fail threshold: 'warn' treats warnings as failures, 'error' only errors\n * @returns Appropriate exit code\n */\nexport function getExitCodeFromIssues(\n issues: CheckIssue[],\n failOn: 'warn' | 'error' = 'error'\n): ExitCode {\n const severityCounts = countSeverities(issues);\n \n // Any error always results in ERROR exit code\n if (severityCounts.error > 0) {\n return ExitCodes.ERROR;\n }\n \n // If failOn is 'warn', warnings cause WARN exit code\n if (failOn === 'warn' && severityCounts.warning > 0) {\n return ExitCodes.WARN;\n }\n \n // All clear\n return ExitCodes.OK;\n}\n\n/**\n * Counts issues by severity.\n * @param issues - Array of check issues\n * @returns Counts for each severity level\n */\nfunction countSeverities(issues: CheckIssue[]): Record<IssueSeverity, number> {\n const counts: Record<IssueSeverity, number> = {\n error: 0,\n warning: 0,\n info: 0,\n };\n \n for (const issue of issues) {\n counts[issue.severity]++;\n }\n \n return counts;\n}\n\n/**\n * Formats exit code description for display.\n * @param code - Exit code\n * @returns Human-readable description\n */\nexport function describeExitCode(code: ExitCode): string {\n switch (code) {\n case ExitCodes.OK:\n return 'Success';\n case ExitCodes.WARN:\n return 'Warnings found';\n case ExitCodes.ERROR:\n return 'Errors found';\n case ExitCodes.NETWORK_ERROR:\n return 'Network error';\n case ExitCodes.CONFIG_NOT_FOUND:\n return 'Configuration file not found';\n case ExitCodes.INVALID_CONFIG:\n return 'Invalid configuration';\n case ExitCodes.FILE_NOT_FOUND:\n return 'File not found';\n case ExitCodes.VALIDATION_FAILED:\n return 'Validation failed';\n case ExitCodes.GENERATION_FAILED:\n return 'Generation failed';\n case ExitCodes.PERMISSION_DENIED:\n return 'Permission denied';\n case ExitCodes.COMMAND_NOT_FOUND:\n return 'Command not found';\n default:\n return `Unknown exit code: ${code}`;\n }\n}\n","/**\n * Configuration schema for llm-seo.\n * Full LlmsSeoConfig schema with all required fields and validation rules.\n */\n\nimport { z } from 'zod';\n\n/**\n * Schema for site configuration.\n */\nexport const SiteConfigSchema = z.object({\n /** Site base URL - must be valid URL with http/https, no trailing slash */\n baseUrl: z\n .string()\n .url({ message: 'Must be a valid URL with http or https protocol' })\n .refine(\n (url) => !url.endsWith('/'),\n { message: 'Base URL must not have a trailing slash' }\n ),\n /** Default locale - must be in locales if provided */\n defaultLocale: z.string().min(2).optional(),\n});\n\n/**\n * Type for site configuration.\n */\nexport type SiteConfig = z.infer<typeof SiteConfigSchema>;\n\n/**\n * Schema for brand configuration.\n */\nexport const BrandConfigSchema = z.object({\n /** Brand name - required */\n name: z.string().min(1, { message: 'Brand name is required' }),\n /** Optional tagline */\n tagline: z.string().optional(),\n /** Optional description */\n description: z.string().optional(),\n /** Optional organization name */\n org: z.string().optional(),\n /** Supported locales - e.g., [\"en\", \"uk\", \"de\"] */\n locales: z.array(z.string().min(2)).min(1, { message: 'At least one locale is required' }),\n});\n\n/**\n * Type for brand configuration.\n */\nexport type BrandConfig = z.infer<typeof BrandConfigSchema>;\n\n/**\n * Schema for sections configuration.\n */\nexport const SectionsConfigSchema = z.object({\n /** Hub paths - e.g., [\"/services\", \"/blog\", \"/projects\"] */\n hubs: z.array(z.string()).default([]),\n});\n\n/**\n * Type for sections configuration.\n */\nexport type SectionsConfig = z.infer<typeof SectionsConfigSchema>;\n\n/**\n * Schema for social links configuration.\n */\nexport const SocialConfigSchema = z.object({\n /** Twitter handle or URL */\n twitter: z.string().optional(),\n /** LinkedIn URL */\n linkedin: z.string().optional(),\n /** GitHub URL */\n github: z.string().optional(),\n});\n\n/**\n * Type for social links configuration.\n */\nexport type SocialConfig = z.infer<typeof SocialConfigSchema>;\n\n/**\n * Schema for contact configuration.\n * At least email or one social field required.\n */\nexport const ContactConfigSchema = z.object({\n /** Contact email */\n email: z.string().email().optional(),\n /** Social links */\n social: SocialConfigSchema.optional(),\n /** Phone number */\n phone: z.string().optional(),\n});\n\n/**\n * Type for contact configuration.\n */\nexport type ContactConfig = z.infer<typeof ContactConfigSchema>;\n\n/**\n * Schema for restricted claims configuration.\n */\nexport const RestrictedClaimsConfigSchema = z.object({\n /** Enable restricted claims checking */\n enable: z.boolean(),\n /** Forbidden words/phrases - e.g., [\"best\", \"#1\", \"guaranteed\"] */\n forbidden: z.array(z.string()).optional(),\n /** Allowlisted phrases */\n whitelist: z.array(z.string()).optional(),\n});\n\n/**\n * Type for restricted claims configuration.\n */\nexport type RestrictedClaimsConfig = z.infer<typeof RestrictedClaimsConfigSchema>;\n\n/**\n * Schema for policy configuration.\n */\nexport const PolicyConfigSchema = z.object({\n /** Geographic policy statement */\n geoPolicy: z.string().optional(),\n /** Citation rules */\n citationRules: z.string().optional(),\n /** Restricted claims configuration */\n restrictedClaims: RestrictedClaimsConfigSchema.optional(),\n});\n\n/**\n * Type for policy configuration.\n */\nexport type PolicyConfig = z.infer<typeof PolicyConfigSchema>;\n\n/**\n * Schema for booking configuration.\n */\nexport const BookingConfigSchema = z.object({\n /** Booking URL - e.g., Cal.com link */\n url: z.string().url().optional(),\n /** Booking label - e.g., \"Book a consultation\" */\n label: z.string().optional(),\n});\n\n/**\n * Type for booking configuration.\n */\nexport type BookingConfig = z.infer<typeof BookingConfigSchema>;\n\n/**\n * Schema for machine hints configuration.\n */\nexport const MachineHintsConfigSchema = z.object({\n /** URL to robots.txt */\n robots: z.string().url().optional(),\n /** URL to sitemap.xml */\n sitemap: z.string().url().optional(),\n /** URL to llms.txt */\n llmsTxt: z.string().url().optional(),\n /** URL to llms-full.txt */\n llmsFullTxt: z.string().url().optional(),\n});\n\n/**\n * Type for machine hints configuration.\n */\nexport type MachineHintsConfig = z.infer<typeof MachineHintsConfigSchema>;\n\n/**\n * Schema for output paths configuration.\n */\nexport const OutputPathsConfigSchema = z.object({\n /** Path to llms.txt output - e.g., \"public/llms.txt\" */\n llmsTxt: z.string().min(1, { message: 'llmsTxt output path is required' }),\n /** Path to llms-full.txt output - e.g., \"public/llms-full.txt\" */\n llmsFullTxt: z.string().min(1, { message: 'llmsFullTxt output path is required' }),\n /** Path to citations.json output - e.g., \"public/citations.json\" */\n citations: z.string().optional(),\n});\n\n/**\n * Type for output paths configuration.\n */\nexport type OutputPathsConfig = z.infer<typeof OutputPathsConfigSchema>;\n\n/**\n * Schema for output configuration.\n */\nexport const OutputConfigSchema = z.object({\n /** Output paths */\n paths: OutputPathsConfigSchema,\n});\n\n/**\n * Type for output configuration.\n */\nexport type OutputConfig = z.infer<typeof OutputConfigSchema>;\n\n/**\n * Schema for format configuration.\n */\nexport const FormatConfigSchema = z.object({\n /** Trailing slash handling */\n trailingSlash: z.enum(['always', 'never', 'preserve']).default('never'),\n /** Line endings format */\n lineEndings: z.enum(['lf', 'crlf']).default('lf'),\n /** Locale URL strategy */\n localeStrategy: z.enum(['prefix', 'subdomain', 'none']).optional(),\n});\n\n/**\n * Type for format configuration.\n */\nexport type FormatConfig = z.infer<typeof FormatConfigSchema>;\n\n/**\n * Full LlmsSeoConfig schema with all required fields.\n */\nexport const LlmsSeoConfigSchema = z.object({\n /** Site configuration */\n site: SiteConfigSchema,\n /** Brand configuration */\n brand: BrandConfigSchema,\n /** Sections configuration */\n sections: SectionsConfigSchema.optional(),\n /** Manifests configuration */\n manifests: z.record(z.unknown()).default({}),\n /** Contact configuration */\n contact: ContactConfigSchema.optional(),\n /** Policy configuration */\n policy: PolicyConfigSchema.optional(),\n /** Booking configuration */\n booking: BookingConfigSchema.optional(),\n /** Machine hints configuration */\n machineHints: MachineHintsConfigSchema.optional(),\n /** Output configuration */\n output: OutputConfigSchema,\n /** Format configuration */\n format: FormatConfigSchema.optional(),\n});\n\n/**\n * Type for full LlmsSeoConfig.\n */\nexport type LlmsSeoConfig = z.infer<typeof LlmsSeoConfigSchema>;\n\n// Legacy exports for backwards compatibility\nexport const ConfigSchema = z.object({\n baseUrl: z.string().url(),\n title: z.string().min(1),\n description: z.string().optional(),\n outputDir: z.string().default('./public'),\n includeOptionalSections: z.boolean().default(false),\n maxContentLength: z.number().int().nonnegative().default(0),\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\n\nexport const LocaleConfigSchema = z.object({\n default: z.string().min(2),\n supported: z.array(z.string().min(2)).min(1),\n strategy: z.enum(['subdirectory', 'subdomain', 'domain']),\n});\n\nexport type LocaleConfigSchemaType = z.infer<typeof LocaleConfigSchema>;\n\nexport const CheckConfigSchema = z.object({\n strict: z.boolean().default(false),\n maxTitleLength: z.number().int().positive().default(60),\n maxDescriptionLength: z.number().int().positive().default(160),\n enableLint: z.boolean().default(true),\n});\n\nexport type CheckConfig = z.infer<typeof CheckConfigSchema>;\n\nexport const FullConfigSchema = z.object({\n site: ConfigSchema,\n locale: LocaleConfigSchema.optional(),\n check: CheckConfigSchema.optional(),\n});\n\nexport type FullConfig = z.infer<typeof FullConfigSchema>;\n","/**\n * File system utilities for CLI operations.\n * Provides atomic file writes and safe file operations.\n */\n\nimport { readFile, writeFile, mkdir, access, stat, rename, unlink } from 'node:fs/promises';\nimport { dirname, join, basename } from 'node:path';\nimport { randomBytes } from 'node:crypto';\n\n/**\n * Reads a file and returns its contents as a string.\n * @param filePath - Path to the file\n * @returns File contents\n * @throws Error if file cannot be read\n */\nexport async function readTextFile(filePath: string): Promise<string> {\n const buffer = await readFile(filePath);\n return buffer.toString('utf-8');\n}\n\n/**\n * Reads a file and parses it as JSON.\n * @param filePath - Path to the file\n * @returns Parsed JSON object\n * @throws Error if file cannot be read or parsed\n */\nexport async function readJsonFile<T>(filePath: string): Promise<T> {\n const content = await readTextFile(filePath);\n return JSON.parse(content) as T;\n}\n\n/**\n * Writes text content to a file.\n * @param filePath - Path to the file\n * @param content - Content to write\n */\nexport async function writeTextFile(filePath: string, content: string): Promise<void> {\n const dir = dirname(filePath);\n await mkdir(dir, { recursive: true });\n await writeFile(filePath, content, 'utf-8');\n}\n\n/**\n * Writes an object as JSON to a file.\n * @param filePath - Path to the file\n * @param data - Data to write\n * @param pretty - Whether to format with indentation\n */\nexport async function writeJsonFile<T>(\n filePath: string,\n data: T,\n pretty = true\n): Promise<void> {\n const content = pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);\n await writeTextFile(filePath, content);\n}\n\n/**\n * Checks if a file exists.\n * @param filePath - Path to check\n * @returns Whether the file exists\n */\nexport async function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Ensures a directory exists.\n * @param dirPath - Directory path\n */\nexport async function ensureDir(dirPath: string): Promise<void> {\n await mkdir(dirPath, { recursive: true });\n}\n\n/**\n * Reads file content safely, returning null if file doesn't exist.\n * @param filePath - Path to the file\n * @returns File content or null if not exists\n */\nexport async function readFileSafe(filePath: string): Promise<string | null> {\n try {\n return await readFile(filePath, 'utf-8');\n } catch {\n return null;\n }\n}\n\n/**\n * Gets file stats (size and modification time).\n * @param filePath - Path to the file\n * @returns File stats or null if not exists\n */\nexport async function getFileStats(\n filePath: string\n): Promise<{ size: number; mtime: Date } | null> {\n try {\n const stats = await stat(filePath);\n return {\n size: stats.size,\n mtime: stats.mtime,\n };\n } catch {\n return null;\n }\n}\n\n/**\n * Writes file atomically (write to temp, then rename).\n * This ensures that readers never see a partially written file.\n * @param filePath - Final destination path\n * @param content - Content to write\n */\nexport async function writeFileAtomic(filePath: string, content: string): Promise<void> {\n const dir = dirname(filePath);\n \n // Ensure destination directory exists\n await ensureDir(dir);\n \n // Create temp file in the same directory for reliable rename\n const uniqueId = randomBytes(8).toString('hex');\n const baseName = basename(filePath);\n const tempPath = join(dir, `.tmp-${uniqueId}-${baseName}`);\n \n try {\n // Write to temp file\n await writeFile(tempPath, content, 'utf-8');\n \n // Atomic rename (on same filesystem)\n await rename(tempPath, filePath);\n } catch (error) {\n // Clean up temp file on error\n try {\n await unlink(tempPath);\n } catch {\n // Ignore cleanup errors\n }\n throw error;\n }\n}\n\n/**\n * Writes JSON file atomically.\n * @param filePath - Final destination path\n * @param data - Data to write\n * @param pretty - Whether to format with indentation\n */\nexport async function writeJsonFileAtomic<T>(\n filePath: string,\n data: T,\n pretty = true\n): Promise<void> {\n const content = pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);\n await writeFileAtomic(filePath, content);\n}\n","/**\n * Configuration loading utilities.\n * Supports loading from TypeScript and JSON config files.\n */\n\nimport { existsSync } from 'node:fs';\nimport { resolve, extname } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport { LlmsSeoConfigSchema } from '../../schema/config.schema.js';\nimport { readFileSafe } from './fs.js';\n\n/**\n * Validation issue from config parsing.\n */\nexport interface ValidationIssue {\n /** Issue severity */\n severity: 'error' | 'warning';\n /** Issue code */\n code: string;\n /** Human-readable message */\n message: string;\n /** Path to the problematic field */\n path?: string;\n}\n\n/**\n * Result of loading config.\n */\nexport interface LoadConfigResult {\n /** Loaded and validated config */\n config: LlmsSeoConfig;\n /** Any validation issues (warnings) */\n issues: ValidationIssue[];\n /** Resolved config file path */\n configPath: string;\n}\n\n/**\n * Options for loading config.\n */\nexport interface LoadConfigOptions {\n /** Path to config file */\n path: string;\n}\n\n/**\n * Default config file names to search.\n */\nexport const CONFIG_FILE_NAMES = [\n 'llm-seo.config.ts',\n 'llm-seo.config.js',\n 'llm-seo.config.json',\n] as const;\n\n/**\n * Finds config file in common locations.\n * @param cwd - Current working directory (defaults to process.cwd())\n * @returns Path to found config file, or null if not found\n */\nexport function findConfigFile(cwd: string = process.cwd()): string | null {\n for (const fileName of CONFIG_FILE_NAMES) {\n const filePath = resolve(cwd, fileName);\n if (existsSync(filePath)) {\n return filePath;\n }\n }\n return null;\n}\n\n/**\n * Gets the file extension and determines if it's a TypeScript file.\n */\nfunction getConfigFileType(filePath: string): 'ts' | 'js' | 'json' {\n const ext = extname(filePath);\n if (ext === '.ts') return 'ts';\n if (ext === '.js') return 'js';\n return 'json';\n}\n\n/**\n * Loads a TypeScript or JavaScript config file using dynamic import.\n * @param configPath - Path to the config file\n * @returns The default export from the module\n */\nasync function importConfigModule<T>(configPath: string): Promise<T> {\n const absolutePath = resolve(configPath);\n const fileUrl = pathToFileURL(absolutePath).href;\n \n // Dynamic import for ESM\n const module = await import(fileUrl);\n \n // Support default export\n const config = module.default ?? module;\n \n return config as T;\n}\n\n/**\n * Parses and validates a raw config object.\n * @param rawConfig - Raw config object\n * @param configPath - Path to config file for error messages\n * @returns Validated config and any issues\n */\nfunction parseConfig(\n rawConfig: unknown,\n configPath: string\n): { config: LlmsSeoConfig; issues: ValidationIssue[] } {\n const issues: ValidationIssue[] = [];\n \n // Parse with Zod\n const result = LlmsSeoConfigSchema.safeParse(rawConfig);\n \n if (!result.success) {\n // Convert Zod errors to ValidationIssues\n const errorMessages = result.error.issues.map((e) => {\n const path = e.path.join('.');\n return `${path}: ${e.message}`;\n }).join('; ');\n \n throw new Error(`Invalid config at ${configPath}: ${errorMessages}`);\n }\n \n return { config: result.data, issues };\n}\n\n/**\n * Loads config from a file path.\n * Supports TypeScript (.ts), JavaScript (.js), and JSON (.json) files.\n * @param options - Load options with path\n * @returns Loaded and validated config with any issues\n */\nexport async function loadConfig(options: LoadConfigOptions): Promise<LoadConfigResult> {\n const { path: configPath } = options;\n const absolutePath = resolve(configPath);\n \n // Check if file exists\n if (!existsSync(absolutePath)) {\n throw new Error(`Config file not found: ${absolutePath}`);\n }\n \n const fileType = getConfigFileType(absolutePath);\n let rawConfig: unknown;\n \n if (fileType === 'json') {\n // Load JSON file\n const content = await readFileSafe(absolutePath);\n if (content === null) {\n throw new Error(`Failed to read config file: ${absolutePath}`);\n }\n try {\n rawConfig = JSON.parse(content);\n } catch {\n throw new Error(`Failed to parse JSON config: ${absolutePath}`);\n }\n } else {\n // Load TS/JS module via dynamic import\n try {\n rawConfig = await importConfigModule<unknown>(absolutePath);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to import config module: ${absolutePath}\\n${message}`);\n }\n }\n \n // Validate config\n const { config, issues } = parseConfig(rawConfig, absolutePath);\n \n return {\n config,\n issues,\n configPath: absolutePath,\n };\n}\n\n/**\n * Loads config with fallback to searching common locations.\n * @param configPath - Optional explicit path to config file\n * @param cwd - Current working directory\n * @returns Loaded config result\n */\nexport async function loadConfigWithDefaults(\n configPath: string | undefined,\n cwd: string = process.cwd()\n): Promise<LoadConfigResult> {\n if (configPath) {\n return loadConfig({ path: configPath });\n }\n \n const foundPath = findConfigFile(cwd);\n \n if (foundPath) {\n return loadConfig({ path: foundPath });\n }\n \n throw new Error(\n `No config file found. Searched for: ${CONFIG_FILE_NAMES.join(', ')}\\n` +\n 'Create a config file or specify one with --config option.'\n );\n}\n\n/**\n * Validates that required config fields are present for a command.\n * @param config - Config to validate\n * @param command - Command name (for error messages)\n * @returns Array of validation issues\n */\nexport function validateConfigForCommand(\n config: LlmsSeoConfig,\n _command: 'generate' | 'check' | 'doctor'\n): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n \n // Check for required site config\n if (!config.site.baseUrl) {\n issues.push({\n severity: 'error',\n code: 'missing_base_url',\n message: 'site.baseUrl is required',\n path: 'site.baseUrl',\n });\n }\n \n // Check for required brand config\n if (!config.brand.name) {\n issues.push({\n severity: 'error',\n code: 'missing_brand_name',\n message: 'brand.name is required',\n path: 'brand.name',\n });\n }\n \n return issues;\n}\n","/**\n * Reporting utilities for CLI output.\n * Provides formatted output for generate, check, and doctor commands.\n */\n\nimport type { CheckResult } from '../../core/check/checker.js';\nimport type { CheckIssue, IssueSeverity } from '../../core/check/issues.js';\n\n/**\n * Doctor check result for endpoint verification.\n */\nexport interface DoctorCheck {\n /** Endpoint name (e.g., \"robots.txt\") */\n name: string;\n /** Full URL checked */\n url: string;\n /** Check status */\n status: 'ok' | 'warn' | 'error' | 'skip';\n /** Human-readable message */\n message: string;\n /** Response time in milliseconds */\n responseTime?: number;\n}\n\n/**\n * Color codes for terminal output.\n */\nconst colors = {\n reset: '\\x1b[0m',\n red: '\\x1b[31m',\n green: '\\x1b[32m',\n yellow: '\\x1b[33m',\n blue: '\\x1b[34m',\n cyan: '\\x1b[36m',\n gray: '\\x1b[90m',\n bold: '\\x1b[1m',\n} as const;\n\n/**\n * Check if colors should be used (respects NO_COLOR env var).\n */\nfunction shouldUseColors(): boolean {\n return process.env.NO_COLOR === undefined && process.stdout.isTTY === true;\n}\n\n/**\n * Colors text for terminal output.\n * @param text - Text to color\n * @param colorCode - Color code\n * @returns Colored text\n */\nfunction color(text: string, colorCode: keyof typeof colors): string {\n if (!shouldUseColors()) {\n return text;\n }\n return `${colors[colorCode]}${text}${colors.reset}`;\n}\n\n/**\n * Prints a success message.\n * @param message - Message to print\n */\nexport function printSuccess(message: string): void {\n console.log(color('[OK]', 'green'), message);\n}\n\n/**\n * Prints an error message.\n * @param message - Message to print\n */\nexport function printError(message: string): void {\n console.error(color('[ERROR]', 'red'), message);\n}\n\n/**\n * Prints a warning message.\n * @param message - Message to print\n */\nexport function printWarning(message: string): void {\n console.warn(color('[WARN]', 'yellow'), message);\n}\n\n/**\n * Prints an info message.\n * @param message - Message to print\n */\nexport function printInfo(message: string): void {\n console.log(color('[INFO]', 'blue'), message);\n}\n\n/**\n * Prints a verbose/debug message.\n * @param message - Message to print\n */\nexport function printVerbose(message: string): void {\n console.log(color(' [debug]', 'gray'), message);\n}\n\n/**\n * Prints a header section.\n * @param title - Section title\n */\nexport function printHeader(title: string): void {\n console.log('');\n console.log(color(title, 'bold'));\n console.log('-'.repeat(title.length));\n}\n\n/**\n * Prints check report to console.\n * @param result - Check result from checker\n * @param verbose - Show detailed output\n */\nexport function printCheckReport(result: CheckResult, verbose: boolean): void {\n console.log('');\n printHeader('SEO Check Results');\n\n const { summary, issues } = result;\n console.log('');\n console.log(`Files checked: ${summary.filesChecked}`);\n console.log(`Files missing: ${summary.filesMissing}`);\n console.log(`Files with issues: ${summary.filesMismatch}`);\n\n console.log('');\n console.log('Summary:');\n\n const errorText = summary.errors > 0\n ? color(`${summary.errors} error${summary.errors !== 1 ? 's' : ''}`, 'red')\n : `${summary.errors} errors`;\n const warningText = summary.warnings > 0\n ? color(`${summary.warnings} warning${summary.warnings !== 1 ? 's' : ''}`, 'yellow')\n : `${summary.warnings} warnings`;\n const infoText = summary.info > 0\n ? color(`${summary.info} info`, 'blue')\n : `${summary.info} info`;\n\n console.log(` ${errorText}, ${warningText}, ${infoText}`);\n\n if (issues.length > 0) {\n console.log('');\n printHeader('Issues');\n\n const issuesByFile = groupIssuesByFile(issues);\n\n for (const [filePath, fileIssues] of issuesByFile) {\n console.log('');\n console.log(color(filePath, 'cyan'));\n\n for (const issue of fileIssues) {\n printCheckIssue(issue, verbose);\n }\n }\n }\n\n console.log('');\n if (summary.errors > 0) {\n console.log(color('FAILED', 'red'), '- Errors found');\n } else if (summary.warnings > 0) {\n console.log(color('PASSED WITH WARNINGS', 'yellow'));\n } else {\n console.log(color('PASSED', 'green'));\n }\n\n console.log('');\n}\n\n/**\n * Prints a single check issue.\n * @param issue - Issue to print\n * @param verbose - Show detailed output\n */\nfunction printCheckIssue(issue: CheckIssue, verbose: boolean): void {\n const severityIcon = issue.severity === 'error'\n ? color('[ERROR]', 'red')\n : issue.severity === 'warning'\n ? color('[WARN]', 'yellow')\n : color('[INFO]', 'blue');\n\n const lineInfo = issue.line !== undefined ? `:${issue.line}` : '';\n const prefix = ` ${severityIcon} ${issue.path}${lineInfo}`;\n\n console.log(`${prefix}: ${issue.message}`);\n\n if (verbose && issue.context) {\n console.log(color(` Context: \"${issue.context}\"`, 'gray'));\n }\n}\n\n/**\n * Groups issues by file path.\n * @param issues - Issues to group\n * @returns Map of file path to issues\n */\nfunction groupIssuesByFile(issues: CheckIssue[]): Map<string, CheckIssue[]> {\n const grouped = new Map<string, CheckIssue[]>();\n\n for (const issue of issues) {\n const existing = grouped.get(issue.path) ?? [];\n existing.push(issue);\n grouped.set(issue.path, existing);\n }\n\n return grouped;\n}\n\n/**\n * File info for generate report.\n */\nexport interface GeneratedFile {\n /** Output file path */\n path: string;\n /** File size in bytes */\n size: number;\n}\n\n/**\n * Prints generate report to console.\n * @param files - List of generated files\n * @param verbose - Show detailed output\n */\nexport function printGenerateReport(files: GeneratedFile[], verbose: boolean): void {\n console.log('');\n printHeader('Generation Complete');\n\n console.log('');\n console.log(`Generated ${files.length} file${files.length !== 1 ? 's' : ''}:`);\n\n for (const file of files) {\n const sizeStr = formatBytes(file.size);\n console.log(` ${color('[OK]', 'green')} ${file.path} (${sizeStr})`);\n\n if (verbose) {\n console.log(color(` Size: ${file.size} bytes`, 'gray'));\n }\n }\n\n const totalSize = files.reduce((sum, f) => sum + f.size, 0);\n console.log('');\n console.log(`Total size: ${formatBytes(totalSize)}`);\n console.log('');\n}\n\n/**\n * Prints doctor report to console.\n * @param checks - List of doctor checks\n * @param verbose - Show detailed output\n */\nexport function printDoctorReport(checks: DoctorCheck[], verbose: boolean): void {\n console.log('');\n printHeader('Diagnostic Results');\n\n console.log('');\n\n for (const check of checks) {\n printDoctorCheck(check, verbose);\n }\n\n console.log('');\n const errors = checks.filter((c) => c.status === 'error').length;\n const warnings = checks.filter((c) => c.status === 'warn').length;\n const ok = checks.filter((c) => c.status === 'ok').length;\n const skipped = checks.filter((c) => c.status === 'skip').length;\n\n console.log(\n `${color('[OK]', 'green')} ${ok} ok, ` +\n `${color('[WARN]', 'yellow')} ${warnings} warning${warnings !== 1 ? 's' : ''}, ` +\n `${color('[ERROR]', 'red')} ${errors} error${errors !== 1 ? 's' : ''}` +\n (skipped > 0 ? `, ${skipped} skipped` : '')\n );\n\n console.log('');\n}\n\n/**\n * Prints a single doctor check.\n * @param check - Check to print\n * @param verbose - Show detailed output\n */\nfunction printDoctorCheck(check: DoctorCheck, verbose: boolean): void {\n const icon = check.status === 'ok'\n ? color('[OK]', 'green')\n : check.status === 'warn'\n ? color('[WARN]', 'yellow')\n : check.status === 'error'\n ? color('[ERROR]', 'red')\n : color('[SKIP]', 'gray');\n\n const timeStr = check.responseTime !== undefined\n ? ` (${check.responseTime}ms)`\n : '';\n\n console.log(`${icon} ${check.name}: ${check.message}${timeStr}`);\n\n if (verbose) {\n console.log(color(` URL: ${check.url}`, 'gray'));\n }\n}\n\n/**\n * Formats error for console output.\n * @param error - Error to format\n * @param verbose - Show detailed output with stack trace\n * @returns Formatted error string\n */\nexport function formatError(error: Error, verbose: boolean): string {\n const lines: string[] = [];\n\n lines.push(color(`Error: ${error.message}`, 'red'));\n\n if (verbose && error.stack) {\n lines.push('');\n lines.push(color('Stack trace:', 'gray'));\n lines.push(error.stack);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Formats bytes to human-readable string.\n * @param bytes - Number of bytes\n * @returns Formatted string (e.g., \"1.5 KB\")\n */\nfunction formatBytes(bytes: number): string {\n if (bytes === 0) return '0 B';\n\n const units = ['B', 'KB', 'MB', 'GB'];\n const k = 1024;\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n const size = bytes / Math.pow(k, i);\n\n if (i === 0) {\n return `${bytes} B`;\n }\n\n const unit = units[i] ?? 'B';\n return `${size.toFixed(1)} ${unit}`;\n}\n\n/**\n * Formats a summary of issues by severity.\n * @param counts - Counts by severity\n * @returns Formatted summary string\n */\nexport function formatSummary(counts: Record<IssueSeverity, number>): string {\n const parts: string[] = [];\n\n if (counts.error > 0) {\n parts.push(color(`${counts.error} error${counts.error !== 1 ? 's' : ''}`, 'red'));\n }\n if (counts.warning > 0) {\n parts.push(color(`${counts.warning} warning${counts.warning !== 1 ? 's' : ''}`, 'yellow'));\n }\n if (counts.info > 0) {\n parts.push(color(`${counts.info} info`, 'blue'));\n }\n\n return parts.join(', ') || color('No issues', 'green');\n}\n\n/**\n * Prints a dry-run output header.\n * @param fileName - File name being output\n */\nexport function printDryRunHeader(fileName: string): void {\n console.log('');\n console.log(color(`--- ${fileName} ---`, 'cyan'));\n}\n\n/**\n * Prints a separator line.\n */\nexport function printSeparator(): void {\n console.log(color('-'.repeat(60), 'gray'));\n}\n","/**\n * URL normalization utilities for deterministic SEO processing.\n */\n\n/**\n * Options for URL normalization.\n */\nexport interface NormalizeUrlOptions {\n /** Base URL e.g., \"https://example.com\" */\n baseUrl: string;\n /** Path e.g., \"/blog/my-post\" */\n path: string;\n /** Trailing slash policy */\n trailingSlash: 'always' | 'never' | 'preserve';\n /** Strip query string (default: true) */\n stripQuery?: boolean;\n /** Strip hash/fragment (default: true) */\n stripHash?: boolean;\n}\n\n/**\n * Normalizes a path by removing double slashes and normalizing dots.\n * @param path - The path to normalize\n * @param preserveTrailingSlash - Whether to preserve trailing slash (default: false)\n * @returns The normalized path\n */\nexport function normalizePath(path: string, preserveTrailingSlash = false): string {\n // Handle empty path\n if (!path || path === '/') {\n return '/';\n }\n\n // Track if original path had trailing slash\n const hadTrailingSlash = path.endsWith('/') && path !== '/';\n\n // Ensure path starts with /\n let normalized = path.startsWith('/') ? path : `/${path}`;\n\n // Collapse multiple consecutive slashes into one\n normalized = normalized.replace(/\\/{2,}/g, '/');\n\n // Handle . and .. segments\n const segments: string[] = [];\n const parts = normalized.split('/');\n\n for (const part of parts) {\n if (part === '.' || part === '') {\n // Skip current directory references and empty parts\n continue;\n } else if (part === '..') {\n // Go up one directory\n if (segments.length > 0) {\n segments.pop();\n }\n } else {\n segments.push(part);\n }\n }\n\n // Reconstruct path\n let result = '/' + segments.join('/');\n \n // Restore trailing slash if needed\n if (preserveTrailingSlash && hadTrailingSlash && result !== '/') {\n result += '/';\n }\n \n return result;\n}\n\n/**\n * Joins URL parts safely, handling slashes between parts.\n * @param parts - URL parts to join\n * @returns Joined path string\n */\nexport function joinUrlParts(...parts: string[]): string {\n if (parts.length === 0) {\n return '/';\n }\n\n // Filter out empty parts\n const filteredParts = parts.filter((part) => part.length > 0);\n\n if (filteredParts.length === 0) {\n return '/';\n }\n\n // Join parts, ensuring single slashes between them\n const joined = filteredParts\n .map((part) => {\n // Remove leading slash from all parts\n let p = part.replace(/^\\/+/, '');\n // Remove trailing slash from all parts except we'll add at the end if needed\n p = p.replace(/\\/+$/, '');\n return p;\n })\n .filter((p) => p.length > 0)\n .join('/');\n\n return joined.length > 0 ? `/${joined}` : '/';\n}\n\n/**\n * Validates that a URL is absolute with http/https protocol.\n * @param url - The URL string to validate\n * @returns True if the URL is a valid absolute http/https URL\n */\nexport function isValidAbsoluteUrl(url: string): boolean {\n if (!url || typeof url !== 'string') {\n return false;\n }\n\n try {\n const parsed = new URL(url);\n return parsed.protocol === 'http:' || parsed.protocol === 'https:';\n } catch {\n return false;\n }\n}\n\n/**\n * Normalizes URL according to policy:\n * - No // in path (collapse to single /)\n * - Strip query and hash by default\n * - Apply trailing slash policy\n * - Lowercase hostname\n * - Remove default ports (80, 443)\n * @param options - Normalization options\n * @returns The normalized URL string\n */\nexport function normalizeUrl(options: NormalizeUrlOptions): string {\n const { baseUrl, path, trailingSlash, stripQuery = true, stripHash = true } = options;\n\n // Parse base URL\n let parsedBase: URL;\n try {\n parsedBase = new URL(baseUrl);\n } catch {\n throw new TypeError(`Invalid baseUrl: ${baseUrl}`);\n }\n\n // Normalize the path with trailing slash preservation flag\n const shouldPreserveTrailingSlash = trailingSlash === 'preserve';\n const normalizedPath = normalizePath(path, shouldPreserveTrailingSlash);\n\n // Apply trailing slash policy\n let finalPath = normalizedPath;\n if (trailingSlash === 'always') {\n // Always add trailing slash (except for root which already has it)\n if (!finalPath.endsWith('/')) {\n finalPath = `${finalPath}/`;\n }\n } else if (trailingSlash === 'never') {\n // Remove trailing slash (except for root)\n if (finalPath !== '/' && finalPath.endsWith('/')) {\n finalPath = finalPath.slice(0, -1);\n }\n }\n // 'preserve' - already handled by normalizePath\n\n // Build the full URL\n const protocol = parsedBase.protocol.toLowerCase();\n let hostname = parsedBase.hostname.toLowerCase();\n\n // Handle port - remove default ports\n let port = parsedBase.port;\n if (port) {\n const isDefaultPort =\n (protocol === 'http:' && port === '80') ||\n (protocol === 'https:' && port === '443');\n if (!isDefaultPort) {\n hostname = `${hostname}:${port}`;\n }\n }\n\n // Build the final URL\n let fullUrl = `${protocol}//${hostname}${finalPath}`;\n\n // Add query string if not stripped\n if (!stripQuery && parsedBase.search) {\n fullUrl += parsedBase.search;\n }\n\n // Add hash if not stripped\n if (!stripHash && parsedBase.hash) {\n fullUrl += parsedBase.hash;\n }\n\n return fullUrl;\n}\n\n/**\n * Sorts URLs deterministically for consistent output ordering.\n * @param urls - Array of URLs to sort\n * @returns Sorted array of URLs\n */\nexport function sortUrls(urls: readonly string[]): string[] {\n return [...urls].sort((a, b) => a.localeCompare(b));\n}\n","/**\n * Deterministic sorting utilities for SEO artifacts.\n */\n\n/**\n * Comparator function type for sorting operations.\n */\nexport type Comparator<T> = (a: T, b: T) => number;\n\n/**\n * Creates a deterministic string comparator for consistent ordering.\n * Uses localeCompare with specific locale for reproducibility.\n * @param a - First string to compare\n * @param b - Second string to compare\n * @returns Negative if a < b, positive if a > b, zero if equal\n */\nexport function compareStrings(a: string, b: string): number {\n return a.localeCompare(b, 'en', { sensitivity: 'case', numeric: true });\n}\n\n/**\n * Sorts an array of strings deterministically.\n * @param items - Array of strings to sort\n * @returns New sorted array\n */\nexport function sortStrings(items: readonly string[]): string[] {\n return [...items].sort(compareStrings);\n}\n\n/**\n * Sorts an array of objects by a string key deterministically.\n * @param items - Array of objects to sort\n * @param keyFn - Function to extract the comparison key\n * @returns New sorted array\n */\nexport function sortBy<T>(items: readonly T[], keyFn: (item: T) => string): T[] {\n return [...items].sort((a, b) => compareStrings(keyFn(a), keyFn(b)));\n}\n\n/**\n * Sorts strings in a deterministic way (localeCompare with numeric).\n * Alias for sortStrings for API consistency.\n * @param items - Array of strings to sort\n * @returns New sorted array\n */\nexport function stableSortStrings(items: string[]): string[] {\n return [...items].sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'case', numeric: true }));\n}\n\n/**\n * Sorts objects by key in a deterministic way.\n * @param items - Array of objects to sort\n * @param keyFn - Function to extract the comparison key\n * @returns New sorted array\n */\nexport function stableSortBy<T>(items: T[], keyFn: (item: T) => string): T[] {\n return [...items].sort((a, b) => {\n const keyA = keyFn(a);\n const keyB = keyFn(b);\n return keyA.localeCompare(keyB, 'en', { sensitivity: 'case', numeric: true });\n });\n}\n\n/**\n * Counts the number of path segments in a URL.\n * @param url - The URL to count segments for\n * @returns Number of path segments\n */\nfunction countPathSegments(url: string): number {\n try {\n const parsed = new URL(url);\n const path = parsed.pathname.replace(/^\\/+/, '').replace(/\\/+$/, '');\n if (!path) return 0;\n return path.split('/').length;\n } catch {\n // If not a valid URL, count slashes in the string\n const cleaned = url.replace(/^\\/+/, '').replace(/\\/+$/, '');\n if (!cleaned) return 0;\n return cleaned.split('/').length;\n }\n}\n\n/**\n * Sorts URLs by path segments (shorter first, then alphabetically).\n * This ensures deterministic ordering with root paths first.\n * @param urls - Array of URLs to sort\n * @returns New sorted array\n */\nexport function sortUrlsByPath(urls: string[]): string[] {\n return [...urls].sort((a, b) => {\n const segmentsA = countPathSegments(a);\n const segmentsB = countPathSegments(b);\n\n // First sort by number of segments (shorter paths first)\n if (segmentsA !== segmentsB) {\n return segmentsA - segmentsB;\n }\n\n // Then sort alphabetically\n return a.localeCompare(b, 'en', { sensitivity: 'case', numeric: true });\n });\n}\n","/**\n * Text normalization utilities for deterministic SEO processing.\n */\n\n/**\n * Normalizes whitespace in text by collapsing multiple spaces and trimming.\n * @param text - The text to normalize\n * @returns Normalized text with single spaces\n */\nexport function normalizeWhitespace(text: string): string {\n return text.replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * Normalizes line endings to the specified format.\n * @param text - The text to normalize\n * @param lineEndings - Target line endings format ('lf' or 'crlf')\n * @returns Text with normalized line endings\n */\nexport function normalizeLineEndings(text: string, lineEndings: 'lf' | 'crlf'): string {\n // First normalize all line endings to \\n\n const normalized = text.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n // Then convert to target format\n return lineEndings === 'crlf' ? normalized.replace(/\\n/g, '\\r\\n') : normalized;\n}\n\n/**\n * Normalizes whitespace in lines - trims trailing whitespace and removes multiple consecutive spaces.\n * @param text - The text to normalize\n * @returns Text with normalized line whitespace\n */\nexport function normalizeLineWhitespace(text: string): string {\n const lines = text.split(/\\r?\\n/);\n return lines\n .map((line) => line.trimEnd().replace(/[ \\t]+/g, (match) => ' '.repeat(match.length === 0 ? 0 : match.length)))\n .map((line) => line.replace(/ +/g, ' '))\n .join('\\n');\n}\n\n/**\n * Normalizes text for use in SEO meta descriptions or titles.\n * Collapses whitespace and truncates to a maximum length.\n * @param text - The text to normalize\n * @param maxLength - Maximum allowed length\n * @returns Normalized text\n */\nexport function normalizeSeoText(text: string, maxLength: number): string {\n const normalized = normalizeWhitespace(text);\n if (normalized.length <= maxLength) {\n return normalized;\n }\n // Truncate at word boundary\n const truncated = normalized.slice(0, maxLength);\n const lastSpace = truncated.lastIndexOf(' ');\n return lastSpace > 0 ? `${truncated.slice(0, lastSpace)}…` : `${truncated.slice(0, -1)}…`;\n}\n","/**\n * Locale handling utilities for canonical URL generation.\n */\n\nimport type { ManifestItem } from '../../schema/manifest.schema.js';\nimport { stableSortStrings } from '../normalize/sort.js';\n\n/**\n * Represents a locale configuration for a site.\n */\nexport interface LocaleConfig {\n /** Default locale code (e.g., 'en') */\n default: string;\n /** Supported locale codes */\n supported: readonly string[];\n /** URL strategy for locales */\n strategy: 'subdirectory' | 'subdomain' | 'domain';\n}\n\n/**\n * Options for selecting canonical locale.\n */\nexport interface SelectCanonicalLocaleOptions {\n /** Default locale code (e.g., 'en') */\n defaultLocale: string;\n /** Available locale codes for the item */\n availableLocales: string[];\n}\n\n/**\n * Selects canonical locale using deterministic algorithm:\n * 1. If defaultLocale is in availableLocales → return defaultLocale\n * 2. Otherwise, sort availableLocales and return first\n * 3. If no locales available → return null\n * @param options - Selection options\n * @returns The canonical locale or null if none available\n */\nexport function selectCanonicalLocale(options: SelectCanonicalLocaleOptions): string | null {\n const { defaultLocale, availableLocales } = options;\n\n // Handle empty/null cases\n if (!availableLocales || availableLocales.length === 0) {\n return null;\n }\n\n // Filter out any null/undefined/empty values\n const validLocales = availableLocales.filter(\n (locale): locale is string => typeof locale === 'string' && locale.length > 0\n );\n\n if (validLocales.length === 0) {\n return null;\n }\n\n // If defaultLocale is available, use it\n if (defaultLocale && validLocales.includes(defaultLocale)) {\n return defaultLocale;\n }\n\n // Otherwise, sort and return first (deterministic)\n const sorted = stableSortStrings(validLocales);\n return sorted[0] ?? null;\n}\n\n/**\n * Determines if a locale is available for an item.\n * @param locale - The locale to check\n * @param availableLocales - Array of available locales\n * @returns True if the locale is available\n */\nexport function isLocaleAvailable(locale: string, availableLocales: string[]): boolean {\n if (!locale || !availableLocales || availableLocales.length === 0) {\n return false;\n }\n return availableLocales.includes(locale);\n}\n\n/**\n * Gets all unique locales from manifest items.\n * @param items - Array of manifest items\n * @returns Array of unique locale codes\n */\nexport function extractAllLocales(items: ManifestItem[]): string[] {\n const localeSet = new Set<string>();\n\n for (const item of items) {\n if (item.locales && Array.isArray(item.locales)) {\n for (const locale of item.locales) {\n if (typeof locale === 'string' && locale.length > 0) {\n localeSet.add(locale);\n }\n }\n }\n }\n\n return stableSortStrings([...localeSet]);\n}\n\n/**\n * Generates locale-prefixed path.\n * @param path - The base path\n * @param locale - The locale code\n * @param config - Locale configuration\n * @returns Path with locale prefix if applicable\n */\nexport function localizePath(\n path: string,\n locale: string,\n config: LocaleConfig\n): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`;\n \n // Default locale may not need prefix\n if (locale === config.default && config.strategy === 'subdirectory') {\n return normalizedPath;\n }\n \n if (config.strategy === 'subdirectory') {\n return `/${locale}${normalizedPath === '/' ? '' : normalizedPath}`;\n }\n \n return normalizedPath;\n}\n\n/**\n * Extracts locale from a path.\n * @param path - The path to extract locale from\n * @param config - Locale configuration\n * @returns Tuple of [locale, pathWithoutLocale]\n */\nexport function extractLocaleFromPath(\n path: string,\n config: LocaleConfig\n): readonly [string, string] {\n if (config.strategy !== 'subdirectory') {\n return [config.default, path];\n }\n \n const match = path.match(/^\\/([a-z]{2}(?:-[A-Z]{2})?)(\\/|$)/);\n \n if (match?.[1] && config.supported.includes(match[1])) {\n const locale = match[1];\n const remainingPath = path.slice(locale.length + 1) || '/';\n return [locale, remainingPath] as const;\n }\n \n return [config.default, path];\n}\n\n/**\n * Generates alternate locale URLs for a page.\n * @param baseUrl - Base URL of the site\n * @param path - Page path\n * @param config - Locale configuration\n * @returns Map of locale to full URL\n */\nexport function generateAlternateUrls(\n baseUrl: string,\n path: string,\n config: LocaleConfig\n): Map<string, string> {\n const urlMap = new Map<string, string>();\n \n for (const locale of config.supported) {\n const localePath = localizePath(path, locale, config);\n const fullUrl = `${baseUrl}${localePath}`;\n urlMap.set(locale, fullUrl);\n }\n \n return urlMap;\n}\n","/**\n * Canonical URL generation from site manifests.\n */\n\nimport type { SiteManifest, ManifestItem } from '../../schema/manifest.schema.js';\nimport { normalizeUrl, joinUrlParts } from '../normalize/url.js';\nimport { sortUrlsByPath } from '../normalize/sort.js';\nimport { selectCanonicalLocale } from './locale.js';\n\n/**\n * Options for canonical URL generation.\n */\nexport interface CanonicalOptions {\n /** Whether to include trailing slash (default: false) */\n trailingSlash?: boolean;\n /** Whether to use lowercase (default: true) */\n lowercase?: boolean;\n}\n\n/**\n * Locale strategy for URL generation.\n */\nexport type LocaleStrategy = 'prefix' | 'subdomain' | 'none';\n\n/**\n * Trailing slash policy.\n */\nexport type TrailingSlashPolicy = 'always' | 'never' | 'preserve';\n\n/**\n * Options for creating canonical URLs from manifest.\n */\nexport interface CreateCanonicalUrlsOptions {\n /** Array of manifest items */\n items: ManifestItem[];\n /** Base URL e.g., \"https://example.com\" */\n baseUrl: string;\n /** Route prefix e.g., \"/blog\" for blog posts */\n routePrefix?: string;\n /** Default locale code */\n defaultLocale: string;\n /** Trailing slash policy */\n trailingSlash: TrailingSlashPolicy;\n /** Locale URL strategy */\n localeStrategy: LocaleStrategy;\n}\n\n/**\n * Generates a canonical URL for a given path from the site manifest.\n * @param manifest - The site manifest containing base URL information\n * @param path - The path to generate canonical URL for\n * @param options - Canonical URL options\n * @returns The canonical URL\n */\nexport function generateCanonicalUrl(\n manifest: SiteManifest,\n path: string,\n options: CanonicalOptions = {}\n): string {\n const { trailingSlash = false, lowercase = true } = options;\n const basePath = path.startsWith('/') ? path : `/${path}`;\n const normalizedPath = trailingSlash\n ? `${basePath}${basePath.endsWith('/') ? '' : '/'}`\n : basePath.replace(/\\/+$/, '') || '/';\n const fullUrl = `${manifest.baseUrl}${normalizedPath}`;\n return lowercase ? fullUrl.toLowerCase() : fullUrl;\n}\n\n/**\n * Extracts all canonical URLs from a site manifest.\n * @param manifest - The site manifest\n * @param options - Canonical URL options\n * @returns Array of canonical URLs\n */\nexport function extractCanonicalUrls(\n manifest: SiteManifest,\n options: CanonicalOptions = {}\n): string[] {\n return manifest.pages.map((page) => generateCanonicalUrl(manifest, page.path, options));\n}\n\n/**\n * Deduplicates URLs by converting to Set and back.\n * @param urls - Array of URLs to deduplicate\n * @returns Array of unique URLs\n */\nexport function dedupeUrls(urls: string[]): string[] {\n return [...new Set(urls)];\n}\n\n/**\n * Builds locale prefix based on strategy.\n * @param locale - The locale code\n * @param strategy - The locale strategy\n * @param defaultLocale - The default locale code\n * @returns Locale prefix string or empty string\n */\nfunction buildLocalePrefix(\n locale: string,\n strategy: LocaleStrategy,\n defaultLocale: string\n): string {\n // No prefix for 'none' strategy\n if (strategy === 'none') {\n return '';\n }\n\n // Subdomain strategy doesn't add path prefix\n if (strategy === 'subdomain') {\n return '';\n }\n\n // For prefix strategy, don't prefix default locale\n if (strategy === 'prefix' && locale === defaultLocale) {\n return '';\n }\n\n return `/${locale}`;\n}\n\n/**\n * Builds base URL with subdomain if needed.\n * @param baseUrl - The base URL\n * @param locale - The locale code\n * @param strategy - The locale strategy\n * @param defaultLocale - The default locale code\n * @returns Base URL with subdomain if applicable\n */\nfunction buildBaseUrlWithSubdomain(\n baseUrl: string,\n locale: string,\n strategy: LocaleStrategy,\n defaultLocale: string\n): string {\n if (strategy !== 'subdomain' || locale === defaultLocale) {\n return baseUrl;\n }\n\n try {\n const parsed = new URL(baseUrl);\n return `${parsed.protocol}//${locale}.${parsed.host}`;\n } catch {\n return baseUrl;\n }\n}\n\n/**\n * Creates a single canonical URL for a manifest item.\n * @param item - The manifest item\n * @param options - Options for URL creation (without items array)\n * @returns The canonical URL string\n */\nexport function createCanonicalUrlForItem(\n item: ManifestItem,\n options: Omit<CreateCanonicalUrlsOptions, 'items'>\n): string {\n const { baseUrl, routePrefix, defaultLocale, trailingSlash, localeStrategy } = options;\n\n // If item has canonicalOverride, use it directly\n if (item.canonicalOverride && typeof item.canonicalOverride === 'string') {\n return item.canonicalOverride;\n }\n\n // Select canonical locale for this item\n const availableLocales = item.locales ?? [defaultLocale];\n const canonicalLocale = selectCanonicalLocale({\n defaultLocale,\n availableLocales,\n });\n\n // If no locale available, use default\n const locale = canonicalLocale ?? defaultLocale;\n\n // Build URL parts\n const localePrefix = buildLocalePrefix(locale, localeStrategy, defaultLocale);\n const effectiveBaseUrl = buildBaseUrlWithSubdomain(baseUrl, locale, localeStrategy, defaultLocale);\n\n // Build the path\n const parts: string[] = [];\n if (localePrefix) {\n parts.push(localePrefix);\n }\n if (routePrefix) {\n parts.push(routePrefix);\n }\n parts.push(item.slug);\n\n const fullPath = joinUrlParts(...parts);\n\n // Normalize the URL\n return normalizeUrl({\n baseUrl: effectiveBaseUrl,\n path: fullPath,\n trailingSlash,\n stripQuery: true,\n stripHash: true,\n });\n}\n\n/**\n * Creates canonical URLs from manifest items:\n * 1. For each item, select canonical locale\n * 2. Build URL: baseUrl + localePrefix (if strategy=prefix) + routePrefix + slug\n * 3. Apply trailing slash policy\n * 4. Normalize URL\n * 5. Dedupe (by URL string)\n * 6. Sort stably\n * @param options - Options for URL creation\n * @returns Sorted array of canonical URLs\n */\nexport function createCanonicalUrlsFromManifest(options: CreateCanonicalUrlsOptions): string[] {\n const { items } = options;\n\n // Handle empty items\n if (!items || items.length === 0) {\n return [];\n }\n\n // Create URLs for each item\n const urls = items.map((item) => createCanonicalUrlForItem(item, options));\n\n // Deduplicate\n const deduped = dedupeUrls(urls);\n\n // Sort stably by path\n return sortUrlsByPath(deduped);\n}\n","/**\n * llms.txt generator for LLM-optimized site documentation.\n * Generates a short brand profile with sections, URLs, policies, and contact info.\n */\n\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport { sortStrings } from '../normalize/sort.js';\nimport { normalizeLineEndings, normalizeLineWhitespace } from '../normalize/text.js';\n\n/**\n * Options for llms.txt generation.\n */\nexport interface CreateLlmsTxtOptions {\n /** Full LLM SEO configuration */\n config: LlmsSeoConfig;\n /** Pre-built canonical URLs from manifests */\n canonicalUrls: string[];\n}\n\n/**\n * Result of llms.txt generation.\n */\nexport interface CreateLlmsTxtResult {\n /** Generated llms.txt content */\n content: string;\n /** Size in bytes */\n byteSize: number;\n /** Number of lines */\n lineCount: number;\n}\n\n/**\n * Creates llms.txt content with deterministic output.\n * - Deterministic ordering of all sections\n * - Handles missing optional fields gracefully\n * - EOL controlled by config.format.lineEndings\n * @param options - Generation options\n * @returns Generated content with metadata\n */\nexport function createLlmsTxt(options: CreateLlmsTxtOptions): CreateLlmsTxtResult {\n const { config, canonicalUrls } = options;\n const lineEndings = config.format?.lineEndings ?? 'lf';\n const lines: string[] = [];\n\n // Header: Brand name and tagline\n lines.push(`# ${config.brand.name}`);\n lines.push('');\n\n if (config.brand.tagline) {\n lines.push(`> ${config.brand.tagline}`);\n lines.push('');\n }\n\n // Brand description\n if (config.brand.description) {\n lines.push(config.brand.description);\n lines.push('');\n }\n\n // Sections\n const hubs = config.sections?.hubs ?? [];\n if (hubs.length > 0) {\n lines.push('## Sections');\n lines.push('');\n const sortedHubs = sortStrings(hubs);\n for (const hub of sortedHubs) {\n const hubLabel = getHubLabel(hub);\n lines.push(`- [${hub}](${hub}) - ${hubLabel}`);\n }\n lines.push('');\n }\n\n // URLs\n if (canonicalUrls.length > 0) {\n lines.push('## URLs');\n lines.push('');\n const sortedUrls = sortStrings(canonicalUrls);\n for (const url of sortedUrls) {\n lines.push(`- ${url}`);\n }\n lines.push('');\n }\n\n // Policies\n const hasPolicies = config.policy?.geoPolicy || config.policy?.citationRules || config.policy?.restrictedClaims;\n if (hasPolicies) {\n lines.push('## Policies');\n lines.push('');\n\n if (config.policy?.geoPolicy) {\n lines.push(`- GEO: ${config.policy.geoPolicy}`);\n }\n\n if (config.policy?.citationRules) {\n lines.push(`- Citations: ${config.policy.citationRules}`);\n }\n\n if (config.policy?.restrictedClaims) {\n const status = config.policy.restrictedClaims.enable ? 'Enabled' : 'Disabled';\n lines.push(`- Restricted Claims: ${status}`);\n }\n\n lines.push('');\n }\n\n // Contact\n const hasContact = config.contact?.email || config.contact?.social || config.contact?.phone;\n const hasBooking = config.booking?.url;\n if (hasContact || hasBooking) {\n lines.push('## Contact');\n lines.push('');\n\n if (config.contact?.email) {\n lines.push(`- Email: ${config.contact.email}`);\n }\n\n if (config.contact?.phone) {\n lines.push(`- Phone: ${config.contact.phone}`);\n }\n\n if (config.contact?.social) {\n if (config.contact.social.twitter) {\n lines.push(`- Twitter: ${config.contact.social.twitter}`);\n }\n if (config.contact.social.linkedin) {\n lines.push(`- LinkedIn: ${config.contact.social.linkedin}`);\n }\n if (config.contact.social.github) {\n lines.push(`- GitHub: ${config.contact.social.github}`);\n }\n }\n\n if (config.booking?.url) {\n const label = config.booking.label ?? 'Book consultation';\n lines.push(`- Booking: ${config.booking.url} (${label})`);\n }\n\n lines.push('');\n }\n\n // Machine Hints\n const hasMachineHints = config.machineHints?.robots || \n config.machineHints?.sitemap || \n config.machineHints?.llmsTxt || \n config.machineHints?.llmsFullTxt;\n \n if (hasMachineHints) {\n lines.push('## Machine Hints');\n lines.push('');\n\n if (config.machineHints?.robots) {\n lines.push(`- robots.txt: ${config.machineHints.robots}`);\n }\n\n if (config.machineHints?.sitemap) {\n lines.push(`- sitemap.xml: ${config.machineHints.sitemap}`);\n }\n\n if (config.machineHints?.llmsTxt) {\n lines.push(`- llms.txt: ${config.machineHints.llmsTxt}`);\n }\n\n if (config.machineHints?.llmsFullTxt) {\n lines.push(`- llms-full.txt: ${config.machineHints.llmsFullTxt}`);\n }\n\n lines.push('');\n }\n\n // Build final content\n let content = lines.join('\\n');\n \n // Normalize whitespace\n content = normalizeLineWhitespace(content);\n \n // Apply line endings\n content = normalizeLineEndings(content, lineEndings);\n\n // Calculate metadata\n const finalLines = content.split(lineEndings === 'crlf' ? '\\r\\n' : '\\n');\n\n return {\n content,\n byteSize: Buffer.byteLength(content, 'utf-8'),\n lineCount: finalLines.length,\n };\n}\n\n/**\n * Gets a human-readable label for a hub path.\n */\nfunction getHubLabel(hub: string): string {\n const labels: Record<string, string> = {\n '/services': 'Services overview',\n '/blog': 'Blog posts',\n '/projects': 'Our projects',\n '/cases': 'Case studies',\n '/contact': 'Contact us',\n '/about': 'About us',\n '/products': 'Products',\n '/docs': 'Documentation',\n '/faq': 'Frequently asked questions',\n '/pricing': 'Pricing information',\n '/team': 'Our team',\n '/careers': 'Career opportunities',\n '/news': 'News and updates',\n '/resources': 'Resources',\n '/support': 'Support center',\n };\n\n return labels[hub] ?? formatHubLabel(hub);\n}\n\n/**\n * Formats a hub path into a human-readable label.\n */\nfunction formatHubLabel(hub: string): string {\n // Remove leading slash and format\n const clean = hub.replace(/^\\//, '');\n // Replace hyphens and underscores with spaces, capitalize words\n return clean\n .replace(/[-_]/g, ' ')\n .replace(/\\b\\w/g, (char) => char.toUpperCase());\n}\n\n// Legacy exports for backwards compatibility\nexport interface LlmsTxtOptions {\n /** Whether to include optional sections */\n includeOptionalSections?: boolean;\n}\n\n/**\n * @deprecated Use createLlmsTxt instead\n */\nexport function generateLlmsTxt(\n manifest: { baseUrl: string; title: string; description?: string | undefined; pages: Array<{ path: string; title?: string | undefined; description?: string | undefined }> },\n _options?: LlmsTxtOptions\n): string {\n const canonicalUrls = manifest.pages.map((page) => `${manifest.baseUrl}${page.path}`);\n \n const config: LlmsSeoConfig = {\n site: { baseUrl: manifest.baseUrl },\n brand: {\n name: manifest.title,\n locales: ['en'],\n ...(manifest.description && { description: manifest.description }),\n },\n manifests: {},\n output: {\n paths: {\n llmsTxt: 'public/llms.txt',\n llmsFullTxt: 'public/llms-full.txt',\n },\n },\n };\n\n return createLlmsTxt({ config, canonicalUrls }).content;\n}\n","/**\n * llms-full.txt generator with complete context for LLMs.\n * Generates full brand context with all URLs, detailed policies, social/booking, and machine hints.\n */\n\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport type { ManifestItem } from '../../schema/manifest.schema.js';\nimport { sortStrings, sortBy } from '../normalize/sort.js';\nimport { normalizeLineEndings, normalizeLineWhitespace } from '../normalize/text.js';\n\n/**\n * Options for llms-full.txt generation.\n */\nexport interface CreateLlmsFullTxtOptions {\n /** Full LLM SEO configuration */\n config: LlmsSeoConfig;\n /** Pre-built canonical URLs from manifests */\n canonicalUrls: string[];\n /** Manifest items for detailed URL listing */\n manifestItems: ManifestItem[];\n}\n\n/**\n * Result of llms-full.txt generation.\n */\nexport interface CreateLlmsFullTxtResult {\n /** Generated llms-full.txt content */\n content: string;\n /** Size in bytes */\n byteSize: number;\n /** Number of lines */\n lineCount: number;\n}\n\n/**\n * Creates llms-full.txt content with deterministic output.\n * - Complete context with all URLs\n * - Detailed policy sections\n * - Social and booking info\n * - EOL controlled by config.format.lineEndings\n * @param options - Generation options\n * @returns Generated content with metadata\n */\nexport function createLlmsFullTxt(options: CreateLlmsFullTxtOptions): CreateLlmsFullTxtResult {\n const { config, canonicalUrls, manifestItems } = options;\n const lineEndings = config.format?.lineEndings ?? 'lf';\n const lines: string[] = [];\n\n // Header\n lines.push(`# ${config.brand.name} - Full LLM Context`);\n lines.push('');\n\n if (config.brand.tagline) {\n lines.push(`> ${config.brand.tagline}`);\n lines.push('');\n }\n\n // Brand description\n if (config.brand.description) {\n lines.push(config.brand.description);\n lines.push('');\n }\n\n // Organization and locales\n if (config.brand.org) {\n lines.push(`Organization: ${config.brand.org}`);\n }\n lines.push(`Locales: ${config.brand.locales.join(', ')}`);\n lines.push('');\n\n // All Canonical URLs\n if (canonicalUrls.length > 0) {\n lines.push('## All Canonical URLs');\n lines.push('');\n const sortedUrls = sortStrings(canonicalUrls);\n for (const url of sortedUrls) {\n lines.push(`- ${url}`);\n }\n lines.push('');\n }\n\n // Policies\n const hasPolicies = config.policy?.geoPolicy || config.policy?.citationRules || config.policy?.restrictedClaims;\n if (hasPolicies) {\n lines.push('## Policies');\n lines.push('');\n\n // GEO Policy\n if (config.policy?.geoPolicy) {\n lines.push('### GEO Policy');\n lines.push(config.policy.geoPolicy);\n lines.push('');\n }\n\n // Citation Rules\n if (config.policy?.citationRules) {\n lines.push('### Citation Rules');\n lines.push(config.policy.citationRules);\n lines.push('');\n }\n\n // Restricted Claims\n if (config.policy?.restrictedClaims) {\n lines.push('### Restricted Claims');\n const status = config.policy.restrictedClaims.enable ? 'Enabled' : 'Disabled';\n lines.push(`Status: ${status}`);\n \n if (config.policy.restrictedClaims.forbidden && config.policy.restrictedClaims.forbidden.length > 0) {\n lines.push(`Forbidden terms: ${config.policy.restrictedClaims.forbidden.join(', ')}`);\n }\n \n if (config.policy.restrictedClaims.whitelist && config.policy.restrictedClaims.whitelist.length > 0) {\n lines.push(`Exceptions: ${config.policy.restrictedClaims.whitelist.join(', ')}`);\n }\n \n lines.push('');\n }\n }\n\n // Social & Booking\n const hasSocial = config.contact?.social?.twitter || \n config.contact?.social?.linkedin || \n config.contact?.social?.github;\n const hasBooking = config.booking?.url;\n \n if (hasSocial || hasBooking) {\n lines.push('## Social & Booking');\n lines.push('');\n\n if (config.contact?.social?.twitter) {\n lines.push(`- Twitter: ${config.contact.social.twitter}`);\n }\n\n if (config.contact?.social?.linkedin) {\n lines.push(`- LinkedIn: ${config.contact.social.linkedin}`);\n }\n\n if (config.contact?.social?.github) {\n lines.push(`- GitHub: ${config.contact.social.github}`);\n }\n\n if (config.booking?.url) {\n const label = config.booking.label ?? 'Book consultation';\n lines.push(`- Booking: ${config.booking.url} (${label})`);\n }\n\n lines.push('');\n }\n\n // Machine Hints\n const hasMachineHints = config.machineHints?.robots || \n config.machineHints?.sitemap || \n config.machineHints?.llmsTxt || \n config.machineHints?.llmsFullTxt;\n \n if (hasMachineHints) {\n lines.push('## Machine Hints');\n lines.push('');\n\n if (config.machineHints?.robots) {\n lines.push(`- robots.txt: ${config.machineHints.robots}`);\n }\n\n if (config.machineHints?.sitemap) {\n lines.push(`- sitemap.xml: ${config.machineHints.sitemap}`);\n }\n\n if (config.machineHints?.llmsTxt) {\n lines.push(`- llms.txt: ${config.machineHints.llmsTxt}`);\n }\n\n if (config.machineHints?.llmsFullTxt) {\n lines.push(`- llms-full.txt: ${config.machineHints.llmsFullTxt}`);\n }\n\n lines.push('');\n }\n\n // Sitemap\n const hubs = config.sections?.hubs ?? [];\n if (hubs.length > 0 || manifestItems.length > 0) {\n lines.push('## Sitemap');\n lines.push('');\n\n // Add section hubs first\n if (hubs.length > 0) {\n const sortedHubs = sortStrings(hubs);\n for (const hub of sortedHubs) {\n lines.push(`- [${hub}](${hub}) - ${getHubLabel(hub)}`);\n }\n }\n\n // Add all manifest URLs\n if (manifestItems.length > 0) {\n const sortedItems = sortBy(manifestItems, (item) => item.slug);\n for (const item of sortedItems) {\n const url = item.canonicalOverride ?? `${config.site.baseUrl}${item.slug}`;\n const title = item.title ?? item.slug;\n const locales = item.locales?.join(', ') ?? config.brand.locales[0] ?? 'en';\n lines.push(`- [${title}](${url}) (${locales})`);\n }\n }\n\n lines.push('');\n }\n\n // Build final content\n let content = lines.join('\\n');\n \n // Normalize whitespace\n content = normalizeLineWhitespace(content);\n \n // Apply line endings\n content = normalizeLineEndings(content, lineEndings);\n\n // Calculate metadata\n const finalLines = content.split(lineEndings === 'crlf' ? '\\r\\n' : '\\n');\n\n return {\n content,\n byteSize: Buffer.byteLength(content, 'utf-8'),\n lineCount: finalLines.length,\n };\n}\n\n/**\n * Gets a human-readable label for a hub path.\n */\nfunction getHubLabel(hub: string): string {\n const labels: Record<string, string> = {\n '/services': 'Services overview',\n '/blog': 'Blog posts',\n '/projects': 'Our projects',\n '/cases': 'Case studies',\n '/contact': 'Contact us',\n '/about': 'About us',\n '/products': 'Products',\n '/docs': 'Documentation',\n '/faq': 'Frequently asked questions',\n '/pricing': 'Pricing information',\n '/team': 'Our team',\n '/careers': 'Career opportunities',\n '/news': 'News and updates',\n '/resources': 'Resources',\n '/support': 'Support center',\n };\n\n return labels[hub] ?? formatHubLabel(hub);\n}\n\n/**\n * Formats a hub path into a human-readable label.\n */\nfunction formatHubLabel(hub: string): string {\n // Remove leading slash and format\n const clean = hub.replace(/^\\//, '');\n // Replace hyphens and underscores with spaces, capitalize words\n return clean\n .replace(/[-_]/g, ' ')\n .replace(/\\b\\w/g, (char) => char.toUpperCase());\n}\n\n// Legacy exports for backwards compatibility\nexport interface LlmsFullTxtOptions {\n /** Maximum content length per page (0 = no limit) */\n maxContentLength?: number;\n}\n\n/**\n * Generates full page content for llms-full.txt.\n * @deprecated Use createLlmsFullTxt instead\n */\nexport function generatePageContent(\n page: { path: string; title?: string; description?: string; content?: string },\n manifest: { baseUrl: string },\n _options?: LlmsFullTxtOptions\n): string {\n const maxContentLength = _options?.maxContentLength ?? 0;\n const lines: string[] = [];\n const url = `${manifest.baseUrl}${page.path}`;\n lines.push(`## ${page.title ?? page.path}`);\n lines.push(`URL: ${url}`);\n lines.push('');\n \n if (page.description) {\n lines.push(page.description);\n lines.push('');\n }\n \n if (page.content) {\n let content = page.content;\n if (maxContentLength > 0 && content.length > maxContentLength) {\n content = `${content.slice(0, maxContentLength)}...`;\n }\n lines.push(content);\n lines.push('');\n }\n \n return lines.join('\\n');\n}\n\n/**\n /**\n * @deprecated Use createLlmsFullTxt instead\n */\n export function generateLlmsFullTxt(\n manifest: { baseUrl: string; title: string; description?: string | undefined; pages: Array<{ path: string; title?: string | undefined; description?: string | undefined; content?: string | undefined }> },\n _options?: LlmsFullTxtOptions\n ): string {\n const canonicalUrls = manifest.pages.map((page) => `${manifest.baseUrl}${page.path}`);\n const manifestItems: ManifestItem[] = manifest.pages.map((page) => ({\n slug: page.path,\n title: page.title,\n description: page.description,\n }));\n \n const config: LlmsSeoConfig = {\n site: { baseUrl: manifest.baseUrl },\n brand: {\n name: manifest.title,\n locales: ['en'],\n ...(manifest.description && { description: manifest.description }),\n },\n manifests: {},\n output: {\n paths: {\n llmsTxt: 'public/llms.txt',\n llmsFullTxt: 'public/llms-full.txt',\n },\n },\n };\n \n return createLlmsFullTxt({ config, canonicalUrls, manifestItems }).content;\n }","/**\n * Citation generation utilities for LLM-optimized content.\n * Creates machine-readable citations.json for CI validation.\n */\n\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport type { ManifestItem } from '../../schema/manifest.schema.js';\n\n/**\n * Citation source entry.\n */\nexport interface CitationSource {\n /** Canonical URL */\n url: string;\n /** Priority (0-100) */\n priority: number;\n /** Section name */\n section: string;\n /** Locale code */\n locale: string;\n /** Publication date (ISO 8601) */\n publishedAt?: string;\n /** Last update date (ISO 8601) */\n updatedAt?: string;\n /** Page title */\n title?: string;\n}\n\n/**\n * Site information in citations.json.\n */\nexport interface CitationsSite {\n /** Base URL */\n baseUrl: string;\n /** Site name */\n name: string;\n}\n\n/**\n * Policy information in citations.json.\n */\nexport interface CitationsPolicy {\n /** Geographic policy */\n geoPolicy?: string;\n /** Citation rules */\n citationRules?: string;\n /** Whether restricted claims are enabled */\n restrictedClaimsEnabled: boolean;\n}\n\n/**\n * Complete citations.json structure.\n */\nexport interface CitationsJson {\n /** Schema version */\n version: string;\n /** Generation timestamp (ISO 8601) */\n generated: string;\n /** Site information */\n site: CitationsSite;\n /** Sorted citation sources */\n sources: CitationSource[];\n /** Policy information */\n policy: CitationsPolicy;\n}\n\n/**\n * Options for citations.json generation.\n */\nexport interface CreateCitationsJsonOptions {\n /** Full LLM SEO configuration */\n config: LlmsSeoConfig;\n /** Manifest items to include */\n manifestItems: ManifestItem[];\n /** Section name for these items */\n sectionName: string;\n /** Optional fixed timestamp for deterministic output (tests) */\n fixedTimestamp?: string;\n}\n\n/**\n * Creates citations.json object with deterministic output.\n * - Sorted by priority (descending), then by URL\n * - Includes all manifest items with their metadata\n * @param options - Generation options\n * @returns Citations JSON object\n */\nexport function createCitationsJson(options: CreateCitationsJsonOptions): CitationsJson {\n const { config, manifestItems, sectionName, fixedTimestamp } = options;\n\n // Build sources from manifest items\n const sources: CitationSource[] = manifestItems.map((item) => {\n const url = item.canonicalOverride ?? `${config.site.baseUrl}${item.slug}`;\n const defaultLocale = config.site.defaultLocale ?? config.brand.locales[0] ?? 'en';\n \n return {\n url,\n priority: item.priority ?? 50,\n section: sectionName,\n locale: item.locales?.[0] ?? defaultLocale,\n ...(item.publishedAt && { publishedAt: item.publishedAt }),\n ...(item.updatedAt && { updatedAt: item.updatedAt }),\n ...(item.title && { title: item.title }),\n };\n });\n\n // Sort by priority (descending), then by URL (ascending)\n const sortedSources = sources.sort((a, b) => {\n // First by priority descending\n if (a.priority !== b.priority) {\n return b.priority - a.priority;\n }\n // Then by URL ascending\n return a.url.localeCompare(b.url, 'en', { sensitivity: 'case', numeric: true });\n });\n\n // Build policy\n const policy: CitationsPolicy = {\n restrictedClaimsEnabled: config.policy?.restrictedClaims?.enable ?? false,\n ...(config.policy?.geoPolicy && { geoPolicy: config.policy.geoPolicy }),\n ...(config.policy?.citationRules && { citationRules: config.policy.citationRules }),\n };\n\n return {\n version: '1.0',\n generated: fixedTimestamp ?? new Date().toISOString(),\n site: {\n baseUrl: config.site.baseUrl,\n name: config.brand.name,\n },\n sources: sortedSources,\n policy,\n };\n}\n\n/**\n * Creates citations.json as a formatted string.\n * @param options - Generation options\n * @returns JSON string with 2-space indentation\n */\nexport function createCitationsJsonString(options: CreateCitationsJsonOptions): string {\n const citations = createCitationsJson(options);\n return JSON.stringify(citations, null, 2);\n}\n\n// Legacy exports for backwards compatibility\n\n/**\n * Represents a citation for a page.\n * @deprecated Use CitationSource instead\n */\nexport interface Citation {\n /** The URL being cited */\n url: string;\n /** The title of the cited page */\n title: string;\n /** Optional description */\n description?: string;\n}\n\n/**\n * Generates a citation object for a page.\n * @deprecated Use createCitationsJson instead\n */\nexport function createCitation(\n page: { path: string; title?: string; description?: string },\n manifest: { baseUrl: string }\n): Citation {\n const citation: Citation = {\n url: `${manifest.baseUrl}${page.path}`,\n title: page.title ?? page.path,\n };\n \n if (page.description) {\n citation.description = page.description;\n }\n \n return citation;\n}\n\n/**\n * Generates a citation in markdown format.\n * @deprecated\n */\nexport function citationToMarkdown(citation: Citation): string {\n if (citation.description) {\n return `[${citation.title}](${citation.url}) - ${citation.description}`;\n }\n return `[${citation.title}](${citation.url})`;\n}\n\n/**\n * Generates a citation in JSON-LD format.\n * @deprecated\n */\nexport function citationToJsonLd(citation: Citation): Record<string, string> {\n const jsonLd: Record<string, string> = {\n '@type': 'WebPage',\n name: citation.title,\n url: citation.url,\n };\n \n if (citation.description) {\n jsonLd.description = citation.description;\n }\n \n return jsonLd;\n}\n\n/**\n * Generates a reference list from multiple citations.\n * @deprecated\n */\nexport function generateReferenceList(citations: readonly Citation[]): string {\n const lines: string[] = ['## References', ''];\n \n for (let i = 0; i < citations.length; i++) {\n const citation = citations[i];\n if (citation) {\n const num = i + 1;\n lines.push(`${num}. ${citationToMarkdown(citation)}`);\n }\n }\n \n lines.push('');\n return lines.join('\\n');\n}\n","/**\n * Issue types and utilities for SEO checking.\n */\n\n/**\n * Severity levels for issues.\n */\nexport type IssueSeverity = 'error' | 'warning' | 'info';\n\n/**\n * Categories of SEO issues.\n */\nexport type IssueCategory = \n | 'content'\n | 'structure'\n | 'accessibility'\n | 'performance'\n | 'metadata';\n\n/**\n * Represents a check issue found during file verification.\n */\nexport interface CheckIssue {\n /** File path or config path */\n path: string;\n /** Issue code e.g., 'file_mismatch', 'missing_file' */\n code: CheckIssueCode;\n /** Human-readable message describing the issue */\n message: string;\n /** Severity of the issue */\n severity: IssueSeverity;\n /** Optional line number where the issue was found */\n line?: number;\n /** Context snippet (first N lines or relevant content) */\n context?: string;\n}\n\n/**\n * Issue codes for check issues.\n */\nexport type CheckIssueCode =\n // File issues\n | 'file_missing'\n | 'file_mismatch'\n | 'file_empty'\n // Content issues\n | 'forbidden_term'\n | 'empty_section'\n | 'duplicate_url'\n | 'invalid_url'\n // Config issues\n | 'config_invalid';\n\n/**\n * Legacy Issue interface for backwards compatibility.\n */\nexport interface Issue {\n /** Unique identifier for the issue type */\n id: string;\n /** The page or resource this issue applies to */\n pageId: string;\n /** Severity of the issue */\n severity: IssueSeverity;\n /** Human-readable message describing the issue */\n message: string;\n /** Optional category for grouping */\n category?: IssueCategory;\n /** Optional suggestion for fixing the issue */\n suggestion?: string;\n /** Optional line number where the issue was found */\n line?: number;\n /** Optional column number where the issue was found */\n column?: number;\n}\n\n/**\n * Creates a CheckIssue.\n * @param severity - Issue severity\n * @param code - Issue code\n * @param message - Human-readable message\n * @param path - File path (optional, defaults to empty string)\n * @param context - Context snippet (optional)\n * @returns A CheckIssue object\n */\nexport function createCheckIssue(\n severity: IssueSeverity,\n code: CheckIssueCode,\n message: string,\n path = '',\n context?: string\n): CheckIssue {\n const issue: CheckIssue = {\n path,\n code,\n message,\n severity,\n };\n \n if (context !== undefined) {\n issue.context = context;\n }\n \n return issue;\n}\n\n/**\n * Creates a legacy Issue with default values.\n * @param overrides - Partial issue to override defaults\n * @returns A complete issue object\n */\nexport function createIssue(overrides: Partial<Issue> & Pick<Issue, 'id' | 'pageId' | 'severity' | 'message'>): Issue {\n return {\n category: 'content',\n ...overrides,\n };\n}\n\n/**\n * Converts legacy Issue to CheckIssue.\n * @param issue - Legacy issue\n * @param path - File path\n * @returns CheckIssue object\n */\nexport function issueToCheckIssue(issue: Issue, path: string): CheckIssue {\n const checkIssue: CheckIssue = {\n path,\n code: issue.id as CheckIssueCode,\n message: issue.message,\n severity: issue.severity,\n };\n \n if (issue.line !== undefined) {\n checkIssue.line = issue.line;\n }\n \n if (issue.suggestion !== undefined) {\n checkIssue.context = issue.suggestion;\n }\n \n return checkIssue;\n}\n\n/**\n * Groups check issues by severity.\n * @param issues - List of issues\n * @returns Map of severity to issues\n */\nexport function groupCheckIssuesBySeverity(issues: readonly CheckIssue[]): Map<IssueSeverity, CheckIssue[]> {\n const grouped = new Map<IssueSeverity, CheckIssue[]>();\n \n for (const issue of issues) {\n const existing = grouped.get(issue.severity) ?? [];\n existing.push(issue);\n grouped.set(issue.severity, existing);\n }\n \n return grouped;\n}\n\n/**\n * Groups issues by severity (legacy).\n * @param issues - List of issues\n * @returns Map of severity to issues\n */\nexport function groupBySeverity(issues: readonly Issue[]): Map<IssueSeverity, Issue[]> {\n const grouped = new Map<IssueSeverity, Issue[]>();\n \n for (const issue of issues) {\n const existing = grouped.get(issue.severity) ?? [];\n existing.push(issue);\n grouped.set(issue.severity, existing);\n }\n \n return grouped;\n}\n\n/**\n * Groups issues by page.\n * @param issues - List of issues\n * @returns Map of pageId to issues\n */\nexport function groupByPage(issues: readonly Issue[]): Map<string, Issue[]> {\n const grouped = new Map<string, Issue[]>();\n \n for (const issue of issues) {\n const existing = grouped.get(issue.pageId) ?? [];\n existing.push(issue);\n grouped.set(issue.pageId, existing);\n }\n \n return grouped;\n}\n\n/**\n * Filters issues by minimum severity.\n * @param issues - List of issues\n * @param minSeverity - Minimum severity to include\n * @returns Filtered list of issues\n */\nexport function filterBySeverity(issues: readonly Issue[], minSeverity: IssueSeverity): Issue[] {\n const severityOrder: IssueSeverity[] = ['error', 'warning', 'info'];\n const minIndex = severityOrder.indexOf(minSeverity);\n \n return issues.filter((issue) => {\n const issueIndex = severityOrder.indexOf(issue.severity);\n return issueIndex <= minIndex;\n });\n}\n\n/**\n * Counts issues by severity.\n * @param issues - List of check issues\n * @returns Counts for each severity level\n */\nexport function countSeverities(issues: readonly CheckIssue[]): Record<IssueSeverity, number> {\n const counts: Record<IssueSeverity, number> = {\n error: 0,\n warning: 0,\n info: 0,\n };\n \n for (const issue of issues) {\n counts[issue.severity]++;\n }\n \n return counts;\n}\n\n/**\n * Formats a check issue for display.\n * @param issue - Check issue to format\n * @returns Formatted string\n */\nexport function formatCheckIssue(issue: CheckIssue): string {\n const severityLabel = issue.severity.charAt(0).toUpperCase() + issue.severity.slice(1);\n let output = `${severityLabel}: ${issue.code}\\n`;\n output += ` File: ${issue.path}\\n`;\n \n if (issue.line !== undefined) {\n output += ` Line: ${issue.line}\\n`;\n }\n \n output += ` Message: ${issue.message}`;\n \n if (issue.context) {\n output += `\\n Context: \"${issue.context}\"`;\n }\n \n return output;\n}\n\n/**\n * Formats multiple check issues for display.\n * @param issues - Check issues to format\n * @returns Formatted string\n */\nexport function formatCheckIssues(issues: CheckIssue[]): string {\n return issues.map(formatCheckIssue).join('\\n\\n');\n}\n","/**\n * Rules linter for llms.txt and related files.\n */\n\nimport type { Issue } from './issues.js';\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport { createIssue } from './issues.js';\nimport type { CheckIssue } from './issues.js';\n\n/**\n * Rule definition for linting.\n */\nexport interface LintRule {\n /** Unique rule identifier */\n id: string;\n /** Human-readable description */\n description: string;\n /** Whether the rule is enabled by default */\n enabled: boolean;\n /** The lint function */\n lint: (content: string, filePath: string) => Issue[];\n}\n\n/**\n * Options for linting content.\n */\nexport interface LintOptions {\n /** llms.txt or llms-full.txt content */\n content: string;\n /** LLM-SEO configuration */\n config: LlmsSeoConfig;\n}\n\n/**\n * Result of linting content.\n */\nexport interface LintResult {\n /** Issues found during linting */\n issues: CheckIssue[];\n}\n\n/**\n * Available lint rules.\n */\nexport const LINT_RULES: readonly LintRule[] = [\n {\n id: 'heading-structure',\n description: 'Ensures proper heading structure (h1 -> h2 -> h3)',\n enabled: true,\n lint: lintHeadingStructure,\n },\n {\n id: 'url-format',\n description: 'Validates URL format in links',\n enabled: true,\n lint: lintUrlFormat,\n },\n {\n id: 'trailing-whitespace',\n description: 'Checks for trailing whitespace on lines',\n enabled: true,\n lint: lintTrailingWhitespace,\n },\n {\n id: 'consistent-list-markers',\n description: 'Ensures consistent list marker usage',\n enabled: true,\n lint: lintListMarkers,\n },\n];\n\n/**\n * Lints content against provided rules.\n * @param content - The content to lint\n * @param filePath - Path to the file being linted\n * @param rules - Rules to apply (defaults to all enabled rules)\n * @returns Lint result with issues\n */\nexport function lintContent(\n content: string,\n filePath: string,\n rules: readonly LintRule[] = LINT_RULES.filter((r) => r.enabled)\n): LintResultLegacy {\n const issues: Issue[] = [];\n \n for (const rule of rules) {\n const ruleIssues = rule.lint(content, filePath);\n issues.push(...ruleIssues);\n }\n \n return {\n filePath,\n issues,\n passed: issues.filter((i) => i.severity === 'error').length === 0,\n };\n}\n\n/**\n * Legacy lint result interface.\n */\nexport interface LintResultLegacy {\n /** File path that was linted */\n filePath: string;\n /** Issues found during linting */\n issues: Issue[];\n /** Whether the file passed all rules */\n passed: boolean;\n}\n\n/**\n * Lints content against policy rules:\n * - Forbidden terms (if restrictedClaims.enable)\n * - Empty sections\n * - Duplicate URLs in priority lists\n * - Locale consistency between sections\n * \n * @param options - Lint options\n * @returns Lint result with issues\n */\nexport function lintContentWithConfig(options: LintOptions): LintResult {\n const { content, config } = options;\n const issues: CheckIssue[] = [];\n \n // Check forbidden terms if policy is configured\n if (config.policy?.restrictedClaims?.enable) {\n const forbidden = config.policy.restrictedClaims.forbidden ?? [];\n const whitelist = config.policy.restrictedClaims.whitelist ?? [];\n const forbiddenIssues = checkForbiddenTerms(content, forbidden, whitelist);\n issues.push(...forbiddenIssues);\n }\n \n // Check for empty sections\n const emptySectionIssues = checkEmptySections(content);\n issues.push(...emptySectionIssues);\n \n // Check for duplicate URLs\n const duplicateUrlIssues = checkDuplicateUrls(content);\n issues.push(...duplicateUrlIssues);\n \n return { issues };\n}\n\n/**\n * Checks for forbidden terms in content.\n * @param content - Content to check\n * @param forbidden - List of forbidden terms\n * @param whitelist - List of whitelisted terms (case-insensitive)\n * @returns Array of check issues\n */\nexport function checkForbiddenTerms(\n content: string,\n forbidden: string[],\n whitelist: string[] = []\n): CheckIssue[] {\n const issues: CheckIssue[] = [];\n const lines = content.split('\\n');\n const whitelistLower = whitelist.map((w) => w.toLowerCase());\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === undefined) continue;\n const trimmed = line.trim();\n const loweredTrimmed = trimmed.toLowerCase();\n\n // Do not lint policy definition lines that explicitly list forbidden/allowed terms.\n if (\n loweredTrimmed.startsWith('forbidden terms:') ||\n loweredTrimmed.startsWith('exceptions:')\n ) {\n continue;\n }\n \n for (const term of forbidden) {\n const termLower = term.toLowerCase();\n const lineLower = line.toLowerCase();\n \n // Check if term exists in line\n if (lineLower.includes(termLower)) {\n // Check if it's whitelisted\n const isWhitelisted = whitelistLower.some((w) => \n lineLower.includes(w) && w.includes(termLower)\n );\n \n if (!isWhitelisted) {\n issues.push({\n path: '',\n code: 'forbidden_term',\n message: `Term \"${term}\" is forbidden by policy`,\n severity: 'warning',\n line: i + 1,\n context: trimmed.substring(0, 100),\n });\n }\n }\n }\n }\n \n return issues;\n}\n\n/**\n * Checks for empty sections in content.\n * An empty section is a heading followed only by whitespace/blank lines\n * until the next heading or end of file.\n * Note: The first heading (typically h1 document title) is not checked\n * as it's common to have the title without immediate content.\n * @param content - Content to check\n * @returns Array of check issues\n */\nexport function checkEmptySections(content: string): CheckIssue[] {\n const issues: CheckIssue[] = [];\n const lines = content.split('\\n');\n \n let currentSection: string | null = null;\n let sectionStartLine = 0;\n let sectionHeadingLevel = 0;\n let sectionHasContent = false;\n let sectionWasFirst = false;\n let isFirstHeading = true;\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === undefined) continue;\n \n // Check for markdown heading\n const headingMatch = line.match(/^(#{1,6})\\s+(.+)$/);\n \n if (headingMatch?.[2]) {\n const nextHeadingLevel = headingMatch[1]?.length ?? 0;\n\n // A subsection counts as content for its parent section.\n if (currentSection !== null && nextHeadingLevel > sectionHeadingLevel) {\n sectionHasContent = true;\n }\n\n // Check if previous section was empty (had heading but no content)\n // Skip check for the first heading (document title)\n if (currentSection !== null && !sectionHasContent && !sectionWasFirst) {\n issues.push({\n path: '',\n code: 'empty_section',\n message: `Section \"${currentSection}\" has no content`,\n severity: 'info',\n line: sectionStartLine,\n });\n }\n \n // Start new section\n currentSection = headingMatch[2].trim();\n sectionStartLine = i + 1;\n sectionHeadingLevel = nextHeadingLevel;\n sectionHasContent = false;\n sectionWasFirst = isFirstHeading;\n isFirstHeading = false;\n } else if (currentSection !== null) {\n // Non-heading line - check if it has actual content\n if (line.trim().length > 0) {\n sectionHasContent = true;\n }\n }\n }\n \n // Check last section (skip if it's the only/first heading)\n if (currentSection !== null && !sectionHasContent && !sectionWasFirst) {\n issues.push({\n path: '',\n code: 'empty_section',\n message: `Section \"${currentSection}\" has no content`,\n severity: 'info',\n line: sectionStartLine,\n });\n }\n \n return issues;\n}\n\n/**\n * Checks for duplicate URLs in content.\n * @param content - Content to check\n * @returns Array of check issues\n */\nexport function checkDuplicateUrls(content: string): CheckIssue[] {\n const issues: CheckIssue[] = [];\n const lines = content.split('\\n');\n const seenUrls = new Map<string, number>();\n \n // Pattern to match markdown links\n const urlPattern = /\\[([^\\]]*)\\]\\(([^)]+)\\)/g;\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === undefined) continue;\n \n let match: RegExpExecArray | null = urlPattern.exec(line);\n while (match !== null) {\n const url = match[2];\n if (url !== undefined) {\n const firstOccurrence = seenUrls.get(url);\n if (firstOccurrence !== undefined) {\n issues.push({\n path: '',\n code: 'duplicate_url',\n message: `URL \"${url}\" appears multiple times (first at line ${firstOccurrence})`,\n severity: 'warning',\n line: i + 1,\n context: url,\n });\n } else {\n seenUrls.set(url, i + 1);\n }\n }\n match = urlPattern.exec(line);\n }\n \n // Reset regex state for next line\n urlPattern.lastIndex = 0;\n }\n \n return issues;\n}\n\n/**\n * Lints heading structure in markdown content.\n */\nfunction lintHeadingStructure(content: string, filePath: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n let prevLevel = 0;\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === undefined) continue;\n const match = line.match(/^(#{1,6})\\s/);\n if (match?.[1]) {\n const level = match[1].length;\n if (level > prevLevel + 1 && prevLevel > 0) {\n issues.push(createIssue({\n id: 'heading-skip',\n pageId: filePath,\n severity: 'warning',\n message: `Heading level skipped: h${prevLevel} to h${level}`,\n line: i + 1,\n }));\n }\n prevLevel = level;\n }\n }\n \n return issues;\n}\n\n/**\n * Lints URL format in markdown content.\n */\nfunction lintUrlFormat(content: string, filePath: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n const urlPattern = /\\[([^\\]]*)\\]\\(([^)]+)\\)/g;\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === undefined) continue;\n let match: RegExpExecArray | null = urlPattern.exec(line);\n while (match !== null) {\n const url = match[2];\n if (url && !url.startsWith('/') && !url.startsWith('http') && !url.startsWith('#')) {\n issues.push(createIssue({\n id: 'invalid-url',\n pageId: filePath,\n severity: 'warning',\n message: `Invalid URL format: ${url}`,\n line: i + 1,\n column: match.index + 1,\n }));\n }\n match = urlPattern.exec(line);\n }\n }\n \n return issues;\n}\n\n/**\n * Lints trailing whitespace in content.\n */\nfunction lintTrailingWhitespace(content: string, filePath: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line !== undefined && line.endsWith(' ')) {\n issues.push(createIssue({\n id: 'trailing-whitespace',\n pageId: filePath,\n severity: 'info',\n message: 'Line has trailing whitespace',\n line: i + 1,\n }));\n }\n }\n \n return issues;\n}\n\n/**\n * Lints list marker consistency in content.\n */\nfunction lintListMarkers(content: string, filePath: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n const dashCount = lines.filter((l) => /^\\s*-\\s/.test(l)).length;\n const asteriskCount = lines.filter((l) => /^\\s*\\*\\s/.test(l)).length;\n \n if (dashCount > 0 && asteriskCount > 0) {\n issues.push(createIssue({\n id: 'inconsistent-list-markers',\n pageId: filePath,\n severity: 'info',\n message: 'Mix of - and * list markers detected',\n }));\n }\n \n return issues;\n}\n","/**\n * SEO checker for LLM-optimized content validation.\n */\n\nimport * as fs from 'node:fs/promises';\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport type { SiteManifest } from '../../schema/manifest.schema.js';\nimport type { Issue, IssueSeverity } from './issues.js';\nimport type { CheckIssue, CheckIssueCode } from './issues.js';\nimport { createCheckIssue, countSeverities } from './issues.js';\nimport { lintContent as lintWithRules, checkForbiddenTerms, checkEmptySections, checkDuplicateUrls } from './rules-linter.js';\nimport { ExitCode } from '../../cli/exit-codes.js';\n\n/**\n * Configuration for the SEO checker.\n */\nexport interface CheckerConfig {\n /** Enable strict mode for additional checks */\n strict?: boolean;\n /** Maximum allowed title length */\n maxTitleLength?: number;\n /** Maximum allowed description length */\n maxDescriptionLength?: number;\n}\n\n/**\n * Options for checking generated files.\n */\nexport interface CheckOptions {\n /** LLM-SEO configuration */\n config: LlmsSeoConfig;\n /** Path to llms.txt (default from config) */\n llmsTxtPath?: string;\n /** Path to llms-full.txt (default from config) */\n llmsFullTxtPath?: string;\n /** Path to citations.json (optional) */\n citationsPath?: string;\n /** Fail threshold */\n failOn: 'warn' | 'error';\n}\n\n/**\n * Result of running the SEO checker.\n */\nexport interface CheckerResult {\n /** Whether all checks passed */\n passed: boolean;\n /** List of issues found */\n issues: Issue[];\n /** Number of pages checked */\n pagesChecked: number;\n /** Summary of issues by severity */\n summary: Record<IssueSeverity, number>;\n}\n\n/**\n * Result of checking generated files.\n */\nexport interface CheckResult {\n /** List of issues found */\n issues: CheckIssue[];\n /** Summary counts */\n summary: {\n errors: number;\n warnings: number;\n info: number;\n filesChecked: number;\n filesMissing: number;\n filesMismatch: number;\n };\n /** Exit code for CI */\n exitCode: ExitCode;\n}\n\n/**\n * Result of content comparison.\n */\nexport interface CompareResult {\n /** Whether content matches */\n match: boolean;\n /** Context showing differences */\n context: string;\n}\n\n/**\n * Default checker configuration.\n */\nexport const DEFAULT_CHECKER_CONFIG: Required<CheckerConfig> = {\n strict: false,\n maxTitleLength: 60,\n maxDescriptionLength: 160,\n};\n\n/**\n * Runs SEO checks on a site manifest.\n * @param manifest - The site manifest to check\n * @param config - Checker configuration\n * @returns Checker result with issues and summary\n */\nexport function checkManifest(\n manifest: SiteManifest,\n config: CheckerConfig = {}\n): CheckerResult {\n const fullConfig = { ...DEFAULT_CHECKER_CONFIG, ...config };\n const issues: Issue[] = [];\n \n // Check each page\n for (const page of manifest.pages) {\n const pageIssues = checkPage(page, fullConfig);\n issues.push(...pageIssues);\n }\n \n // Calculate summary\n const summary: Record<IssueSeverity, number> = {\n error: 0,\n warning: 0,\n info: 0,\n };\n \n for (const issue of issues) {\n summary[issue.severity]++;\n }\n \n return {\n passed: summary.error === 0,\n issues,\n pagesChecked: manifest.pages.length,\n summary,\n };\n}\n\n/**\n * Checks a single page for SEO issues.\n * @param page - The page to check\n * @param config - Checker configuration\n * @returns List of issues found\n */\nfunction checkPage(\n page: { path: string; title?: string | undefined; description?: string | undefined },\n config: Required<CheckerConfig>\n): Issue[] {\n const issues: Issue[] = [];\n const pageId = page.path;\n \n // Check title\n if (!page.title) {\n issues.push({\n id: 'missing-title',\n pageId,\n severity: 'warning',\n message: 'Page is missing a title',\n });\n } else if (page.title.length > config.maxTitleLength) {\n issues.push({\n id: 'title-too-long',\n pageId,\n severity: 'warning',\n message: `Title exceeds ${config.maxTitleLength} characters (${page.title.length})`,\n });\n }\n \n // Check description\n if (!page.description) {\n issues.push({\n id: 'missing-description',\n pageId,\n severity: 'warning',\n message: 'Page is missing a description',\n });\n } else if (page.description.length > config.maxDescriptionLength) {\n issues.push({\n id: 'description-too-long',\n pageId,\n severity: 'info',\n message: `Description exceeds ${config.maxDescriptionLength} characters (${page.description.length})`,\n });\n }\n \n return issues;\n}\n\n/**\n * Main check function:\n * 1. Validates config\n * 2. Reads existing files from disk\n * 3. Compares expected vs actual (if expected content provided)\n * 4. Runs linting rules\n * 5. Returns issues with summary\n * \n * @param options - Check options\n * @returns Check result with issues and exit code\n */\nexport async function checkGeneratedFiles(options: CheckOptions): Promise<CheckResult> {\n const issues: CheckIssue[] = [];\n let filesChecked = 0;\n let filesMissing = 0;\n let filesMismatch = 0;\n \n const { config, failOn } = options;\n \n // Get file paths from config\n const llmsTxtPath = options.llmsTxtPath ?? config.output.paths.llmsTxt;\n const llmsFullTxtPath = options.llmsFullTxtPath ?? config.output.paths.llmsFullTxt;\n const citationsPath = options.citationsPath ?? config.output.paths.citations;\n \n // Check llms.txt\n const llmsTxtResult = await checkFile(llmsTxtPath);\n if (!llmsTxtResult.exists) {\n issues.push(createCheckIssue(\n 'error',\n 'file_missing',\n `Required file does not exist: ${llmsTxtPath}`,\n llmsTxtPath\n ));\n filesMissing++;\n } else if (llmsTxtResult.content === '') {\n issues.push(createCheckIssue(\n 'warning',\n 'file_empty',\n `File is empty: ${llmsTxtPath}`,\n llmsTxtPath\n ));\n filesChecked++;\n } else {\n filesChecked++;\n // Run content linter on llms.txt\n const lintIssues = await lintFile(llmsTxtPath, llmsTxtResult.content, config);\n issues.push(...lintIssues);\n }\n \n // Check llms-full.txt\n const llmsFullTxtResult = await checkFile(llmsFullTxtPath);\n if (!llmsFullTxtResult.exists) {\n issues.push(createCheckIssue(\n 'error',\n 'file_missing',\n `Required file does not exist: ${llmsFullTxtPath}`,\n llmsFullTxtPath\n ));\n filesMissing++;\n } else if (llmsFullTxtResult.content === '') {\n issues.push(createCheckIssue(\n 'warning',\n 'file_empty',\n `File is empty: ${llmsFullTxtPath}`,\n llmsFullTxtPath\n ));\n filesChecked++;\n } else {\n filesChecked++;\n // Run content linter on llms-full.txt\n const lintIssues = await lintFile(llmsFullTxtPath, llmsFullTxtResult.content, config);\n issues.push(...lintIssues);\n }\n \n // Check citations.json (optional)\n if (citationsPath) {\n const citationsResult = await checkFile(citationsPath);\n if (!citationsResult.exists) {\n issues.push(createCheckIssue(\n 'warning',\n 'file_missing',\n `Optional citations file does not exist: ${citationsPath}`,\n citationsPath\n ));\n filesMissing++;\n } else {\n filesChecked++;\n }\n }\n \n // Calculate summary\n const severityCounts = countSeverities(issues);\n \n // Determine exit code\n let exitCode: ExitCode;\n if (severityCounts.error > 0) {\n exitCode = 2; // ERROR\n } else if (failOn === 'warn' && severityCounts.warning > 0) {\n exitCode = 1; // WARN\n } else {\n exitCode = 0; // OK\n }\n \n return {\n issues,\n summary: {\n errors: severityCounts.error,\n warnings: severityCounts.warning,\n info: severityCounts.info,\n filesChecked,\n filesMissing,\n filesMismatch,\n },\n exitCode,\n };\n}\n\n/**\n * Checks if a file exists.\n * @param filePath - Path to the file\n * @returns Promise resolving to true if file exists\n */\nexport async function checkFileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks a file and returns its content.\n * @param filePath - Path to the file\n * @returns Object with exists flag and content\n */\nasync function checkFile(filePath: string): Promise<{ exists: boolean; content: string }> {\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n return { exists: true, content };\n } catch {\n return { exists: false, content: '' };\n }\n}\n\n/**\n * Reads file content safely.\n * @param filePath - Path to the file\n * @returns File content or null if file doesn't exist\n */\nexport async function readFileContent(filePath: string): Promise<string | null> {\n try {\n return await fs.readFile(filePath, 'utf-8');\n } catch {\n return null;\n }\n}\n\n/**\n * Compares two strings and returns diff context.\n * @param expected - Expected content\n * @param actual - Actual content\n * @param maxContextLines - Maximum number of diff lines to show (default: 5)\n * @returns CompareResult with match status and context\n */\nexport function compareContent(\n expected: string,\n actual: string,\n maxContextLines = 5\n): CompareResult {\n if (expected === actual) {\n return { match: true, context: '' };\n }\n \n const expectedLines = expected.split('\\n');\n const actualLines = actual.split('\\n');\n const contextLines: string[] = [];\n let diffCount = 0;\n \n const maxLines = Math.max(expectedLines.length, actualLines.length);\n \n for (let i = 0; i < maxLines && diffCount < maxContextLines; i++) {\n const expectedLine = expectedLines[i];\n const actualLine = actualLines[i];\n \n if (expectedLine !== actualLine) {\n diffCount++;\n const lineNum = i + 1;\n \n if (expectedLine !== undefined) {\n contextLines.push(`Expected line ${lineNum}: \"${expectedLine}\"`);\n }\n if (actualLine !== undefined) {\n contextLines.push(`Actual line ${lineNum}: \"${actualLine}\"`);\n }\n }\n }\n \n return {\n match: false,\n context: contextLines.join('\\n'),\n };\n}\n\n/**\n * Lints a file content against policy rules.\n * @param filePath - Path to the file\n * @param content - File content\n * @param config - LLM-SEO configuration\n * @returns Array of check issues\n */\nasync function lintFile(\n filePath: string,\n content: string,\n config: LlmsSeoConfig\n): Promise<CheckIssue[]> {\n const issues: CheckIssue[] = [];\n \n // Run basic linting rules\n const lintResult = lintWithRules(content, filePath);\n for (const issue of lintResult.issues) {\n const checkIssue: CheckIssue = {\n path: filePath,\n code: issue.id as CheckIssueCode,\n message: issue.message,\n severity: issue.severity,\n };\n if (issue.line !== undefined) {\n checkIssue.line = issue.line;\n }\n if (issue.suggestion !== undefined) {\n checkIssue.context = issue.suggestion;\n }\n issues.push(checkIssue);\n }\n \n // Check forbidden terms if policy is configured\n if (config.policy?.restrictedClaims?.enable) {\n const forbidden = config.policy.restrictedClaims.forbidden ?? [];\n const whitelist = config.policy.restrictedClaims.whitelist ?? [];\n const forbiddenIssues = checkForbiddenTerms(content, forbidden, whitelist);\n \n for (const issue of forbiddenIssues) {\n const checkIssue: CheckIssue = {\n path: filePath,\n code: 'forbidden_term',\n message: issue.message,\n severity: issue.severity,\n };\n if (issue.line !== undefined) {\n checkIssue.line = issue.line;\n }\n if (issue.context !== undefined) {\n checkIssue.context = issue.context;\n }\n issues.push(checkIssue);\n }\n }\n \n // Check for empty sections\n const emptySectionIssues = checkEmptySections(content);\n for (const issue of emptySectionIssues) {\n const checkIssue: CheckIssue = {\n path: filePath,\n code: 'empty_section',\n message: issue.message,\n severity: issue.severity,\n };\n if (issue.line !== undefined) {\n checkIssue.line = issue.line;\n }\n if (issue.context !== undefined) {\n checkIssue.context = issue.context;\n }\n issues.push(checkIssue);\n }\n \n // Check for duplicate URLs\n const duplicateUrlIssues = checkDuplicateUrls(content);\n for (const issue of duplicateUrlIssues) {\n const checkIssue: CheckIssue = {\n path: filePath,\n code: 'duplicate_url',\n message: issue.message,\n severity: issue.severity,\n };\n if (issue.line !== undefined) {\n checkIssue.line = issue.line;\n }\n if (issue.context !== undefined) {\n checkIssue.context = issue.context;\n }\n issues.push(checkIssue);\n }\n \n return issues;\n}\n\n/**\n * Checks generated files against expected content.\n * @param llmsTxtPath - Path to llms.txt\n * @param expectedLlmsTxt - Expected llms.txt content\n * @param llmsFullTxtPath - Path to llms-full.txt\n * @param expectedLlmsFullTxt - Expected llms-full.txt content\n * @param maxContextLines - Maximum context lines for diff\n * @returns Array of check issues\n */\nexport async function checkFilesAgainstExpected(\n llmsTxtPath: string,\n expectedLlmsTxt: string,\n llmsFullTxtPath: string,\n expectedLlmsFullTxt: string,\n maxContextLines = 5\n): Promise<CheckIssue[]> {\n const issues: CheckIssue[] = [];\n \n // Check llms.txt\n const llmsTxtContent = await readFileContent(llmsTxtPath);\n if (llmsTxtContent === null) {\n issues.push(createCheckIssue(\n 'error',\n 'file_missing',\n `Required file does not exist: ${llmsTxtPath}`,\n llmsTxtPath\n ));\n } else if (llmsTxtContent === '') {\n issues.push(createCheckIssue(\n 'warning',\n 'file_empty',\n `File is empty: ${llmsTxtPath}`,\n llmsTxtPath\n ));\n } else {\n const compareResult = compareContent(expectedLlmsTxt, llmsTxtContent, maxContextLines);\n if (!compareResult.match) {\n issues.push(createCheckIssue(\n 'error',\n 'file_mismatch',\n `Content differs from expected output`,\n llmsTxtPath,\n compareResult.context\n ));\n }\n }\n \n // Check llms-full.txt\n const llmsFullTxtContent = await readFileContent(llmsFullTxtPath);\n if (llmsFullTxtContent === null) {\n issues.push(createCheckIssue(\n 'error',\n 'file_missing',\n `Required file does not exist: ${llmsFullTxtPath}`,\n llmsFullTxtPath\n ));\n } else if (llmsFullTxtContent === '') {\n issues.push(createCheckIssue(\n 'warning',\n 'file_empty',\n `File is empty: ${llmsFullTxtPath}`,\n llmsFullTxtPath\n ));\n } else {\n const compareResult = compareContent(expectedLlmsFullTxt, llmsFullTxtContent, maxContextLines);\n if (!compareResult.match) {\n issues.push(createCheckIssue(\n 'error',\n 'file_mismatch',\n `Content differs from expected output`,\n llmsFullTxtPath,\n compareResult.context\n ));\n }\n }\n \n return issues;\n}\n","/**\n * Core module barrel export.\n * Re-exports all core functionality for llm-seo.\n */\n\n// Normalize utilities\nexport { normalizeUrl, sortUrls } from './normalize/url.js';\nexport { compareStrings, sortStrings, sortBy, type Comparator } from './normalize/sort.js';\nexport { normalizeWhitespace, normalizeLineEndings, normalizeLineWhitespace, normalizeSeoText } from './normalize/text.js';\n\n// Canonical utilities\nexport {\n generateCanonicalUrl,\n extractCanonicalUrls,\n createCanonicalUrlsFromManifest,\n createCanonicalUrlForItem,\n dedupeUrls,\n type CreateCanonicalUrlsOptions,\n type LocaleStrategy,\n type TrailingSlashPolicy,\n type CanonicalOptions,\n} from './canonical/canonical-from-manifest.js';\nexport {\n localizePath,\n extractLocaleFromPath,\n generateAlternateUrls,\n type LocaleConfig,\n} from './canonical/locale.js';\n\n// Generate utilities - llms.txt\nexport {\n createLlmsTxt,\n generateLlmsTxt,\n type CreateLlmsTxtOptions,\n type CreateLlmsTxtResult,\n type LlmsTxtOptions,\n} from './generate/llms-txt.js';\n\n// Generate utilities - llms-full.txt\nexport {\n createLlmsFullTxt,\n generateLlmsFullTxt,\n generatePageContent,\n type CreateLlmsFullTxtOptions,\n type CreateLlmsFullTxtResult,\n type LlmsFullTxtOptions,\n} from './generate/llms-full-txt.js';\n\n// Generate utilities - citations\nexport {\n createCitationsJson,\n createCitationsJsonString,\n createCitation,\n citationToMarkdown,\n citationToJsonLd,\n generateReferenceList,\n type CitationSource,\n type CitationsSite,\n type CitationsPolicy,\n type CitationsJson,\n type CreateCitationsJsonOptions,\n type Citation,\n} from './generate/citations.js';\n\n// Check utilities\nexport {\n checkManifest,\n checkGeneratedFiles,\n checkFilesAgainstExpected,\n compareContent,\n readFileContent,\n checkFileExists,\n DEFAULT_CHECKER_CONFIG,\n type CheckerConfig,\n type CheckerResult,\n type CheckOptions,\n type CheckResult,\n type CompareResult,\n} from './check/checker.js';\nexport {\n createIssue,\n groupBySeverity,\n groupByPage,\n filterBySeverity,\n type Issue,\n type IssueSeverity,\n type IssueCategory,\n} from './check/issues.js';\nexport {\n lintContent,\n LINT_RULES,\n type LintRule,\n type LintResult,\n} from './check/rules-linter.js';\n","/**\n * Generate command - generates llms.txt and llms-full.txt.\n * Main implementation of `llm-seo generate` CLI command.\n */\n\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport type { ManifestItem } from '../../schema/manifest.schema.js';\nimport { loadConfig, type LoadConfigResult } from '../io/load-config.js';\nimport { writeFileAtomic } from '../io/fs.js';\nimport {\n printError,\n printWarning,\n printInfo,\n printVerbose,\n printGenerateReport,\n printDryRunHeader,\n printSeparator,\n type GeneratedFile,\n} from '../io/report.js';\nimport { ExitCodes } from '../exit-codes.js';\nimport {\n createLlmsTxt,\n createLlmsFullTxt,\n createCitationsJsonString,\n createCanonicalUrlsFromManifest,\n} from '../../core/index.js';\n\n/**\n * Options for the generate command.\n */\nexport interface GenerateOptions {\n /** Path to config file */\n config: string;\n /** Output to stdout instead of files */\n dryRun: boolean;\n /** Generate citations.json */\n emitCitations: boolean;\n /** Show progress and details */\n verbose: boolean;\n}\n\n/**\n * Result of generation.\n */\ninterface GenerationResult {\n /** Generated files */\n files: GeneratedFile[];\n /** Any warnings during generation */\n warnings: string[];\n}\n\n/**\n * Executes the generate command.\n * @param options - Command options\n * @returns Exit code\n */\nexport async function generateCommand(options: GenerateOptions): Promise<number> {\n const { config: configPath, dryRun, emitCitations, verbose } = options;\n \n try {\n // Step 1: Load config\n if (verbose) {\n printVerbose(`Loading config from: ${configPath}`);\n }\n \n let loadResult: LoadConfigResult;\n try {\n loadResult = await loadConfig({ path: configPath });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n printError(`Failed to load config: ${message}`);\n return ExitCodes.CONFIG_NOT_FOUND;\n }\n \n const { config } = loadResult;\n \n // Report any validation issues\n for (const issue of loadResult.issues) {\n if (issue.severity === 'warning') {\n printWarning(issue.message);\n } else {\n printError(issue.message);\n return ExitCodes.INVALID_CONFIG;\n }\n }\n \n if (verbose) {\n printVerbose(`Config loaded successfully`);\n printVerbose(`Site: ${config.site.baseUrl}`);\n printVerbose(`Brand: ${config.brand.name}`);\n }\n \n // Step 2: Extract manifest items\n const manifestItems = extractManifestItems(config);\n \n if (verbose) {\n printVerbose(`Found ${manifestItems.length} manifest items`);\n }\n \n // Step 3: Build canonical URLs\n const canonicalUrls = createCanonicalUrlsFromManifest({\n items: manifestItems,\n baseUrl: config.site.baseUrl,\n defaultLocale: config.site.defaultLocale ?? config.brand.locales[0] ?? 'en',\n trailingSlash: config.format?.trailingSlash ?? 'never',\n localeStrategy: 'prefix',\n });\n \n if (verbose) {\n printVerbose(`Generated ${canonicalUrls.length} canonical URLs`);\n }\n \n // Step 4: Generate llms.txt\n const llmsTxtResult = createLlmsTxt({ config, canonicalUrls });\n \n // Step 5: Generate llms-full.txt\n const llmsFullTxtResult = createLlmsFullTxt({ \n config, \n canonicalUrls, \n manifestItems \n });\n \n // Step 6: Optionally generate citations.json\n let citationsContent: string | null = null;\n if (emitCitations) {\n citationsContent = createCitationsJsonString({\n config,\n manifestItems,\n sectionName: 'all',\n });\n }\n \n // Step 7: Output files or stdout\n const result: GenerationResult = {\n files: [],\n warnings: [],\n };\n \n if (dryRun) {\n // Output to stdout\n printDryRunHeader(config.output.paths.llmsTxt);\n console.log(llmsTxtResult.content);\n printSeparator();\n \n printDryRunHeader(config.output.paths.llmsFullTxt);\n console.log(llmsFullTxtResult.content);\n printSeparator();\n \n if (citationsContent) {\n printDryRunHeader(config.output.paths.citations ?? 'citations.json');\n console.log(citationsContent);\n printSeparator();\n }\n \n printInfo('Dry run complete - no files written');\n \n result.files = [\n { path: config.output.paths.llmsTxt, size: llmsTxtResult.byteSize },\n { path: config.output.paths.llmsFullTxt, size: llmsFullTxtResult.byteSize },\n ];\n \n if (citationsContent) {\n result.files.push({ \n path: config.output.paths.citations ?? 'citations.json', \n size: Buffer.byteLength(citationsContent, 'utf-8') \n });\n }\n } else {\n // Write files atomically\n if (verbose) {\n printVerbose(`Writing ${config.output.paths.llmsTxt}`);\n }\n await writeFileAtomic(config.output.paths.llmsTxt, llmsTxtResult.content);\n result.files.push({ path: config.output.paths.llmsTxt, size: llmsTxtResult.byteSize });\n \n if (verbose) {\n printVerbose(`Writing ${config.output.paths.llmsFullTxt}`);\n }\n await writeFileAtomic(config.output.paths.llmsFullTxt, llmsFullTxtResult.content);\n result.files.push({ path: config.output.paths.llmsFullTxt, size: llmsFullTxtResult.byteSize });\n \n if (citationsContent && config.output.paths.citations) {\n if (verbose) {\n printVerbose(`Writing ${config.output.paths.citations}`);\n }\n await writeFileAtomic(config.output.paths.citations, citationsContent);\n result.files.push({ \n path: config.output.paths.citations, \n size: Buffer.byteLength(citationsContent, 'utf-8') \n });\n }\n \n printGenerateReport(result.files, verbose);\n }\n \n // Report any warnings\n for (const warning of result.warnings) {\n printWarning(warning);\n }\n \n return ExitCodes.OK;\n \n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n printError(`Generation failed: ${message}`);\n return ExitCodes.GENERATION_FAILED;\n }\n}\n\n/**\n * Extracts manifest items from config.\n * @param config - LLM SEO config\n * @returns Array of manifest items\n */\nfunction extractManifestItems(config: LlmsSeoConfig): ManifestItem[] {\n const items: ManifestItem[] = [];\n const manifests = config.manifests;\n \n // Process each manifest in the manifests record\n for (const [_manifestName, manifestData] of Object.entries(manifests)) {\n if (typeof manifestData === 'object' && manifestData !== null) {\n const data = manifestData as Record<string, unknown>;\n \n // Check if it has pages array\n if (Array.isArray(data.pages)) {\n for (const page of data.pages) {\n const normalized = toManifestItem(page);\n if (normalized) {\n items.push(normalized);\n }\n }\n }\n \n // Check if it's an array directly\n if (Array.isArray(data)) {\n for (const item of data) {\n const normalized = toManifestItem(item);\n if (normalized) {\n items.push(normalized);\n }\n }\n }\n }\n }\n \n return items;\n}\n\nfunction toManifestItem(value: unknown): ManifestItem | null {\n if (typeof value !== 'object' || value === null) {\n return null;\n }\n\n const data = value as Record<string, unknown>;\n const rawSlug = data.slug ?? data.path;\n if (typeof rawSlug !== 'string' || rawSlug.length === 0) {\n return null;\n }\n\n const item: ManifestItem = {\n slug: rawSlug.startsWith('/') ? rawSlug : `/${rawSlug}`,\n };\n\n if (typeof data.title === 'string') {\n item.title = data.title;\n }\n if (typeof data.description === 'string') {\n item.description = data.description;\n }\n if (Array.isArray(data.locales)) {\n const locales = data.locales.filter((loc): loc is string => typeof loc === 'string');\n if (locales.length > 0) {\n item.locales = locales;\n }\n }\n if (typeof data.canonicalOverride === 'string') {\n item.canonicalOverride = data.canonicalOverride;\n }\n if (typeof data.publishedAt === 'string') {\n item.publishedAt = data.publishedAt;\n }\n if (typeof data.updatedAt === 'string') {\n item.updatedAt = data.updatedAt;\n }\n if (typeof data.priority === 'number') {\n item.priority = data.priority;\n }\n\n return item;\n}\n\n// Legacy export for backwards compatibility\nexport interface GenerateCommandOptions {\n config: string;\n output: string;\n full: boolean;\n}\n","/**\n * Check command - validates SEO health of llms.txt files.\n * Main implementation of `llm-seo check` CLI command.\n */\n\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport { loadConfig, type LoadConfigResult } from '../io/load-config.js';\nimport {\n printError,\n printWarning,\n printVerbose,\n printCheckReport,\n} from '../io/report.js';\nimport { ExitCodes } from '../exit-codes.js';\nimport {\n checkGeneratedFiles,\n checkFilesAgainstExpected,\n type CheckOptions as CoreCheckOptions,\n} from '../../core/check/checker.js';\nimport { countSeverities } from '../../core/check/issues.js';\nimport {\n createLlmsTxt,\n createLlmsFullTxt,\n createCanonicalUrlsFromManifest,\n} from '../../core/index.js';\nimport type { ManifestItem } from '../../schema/manifest.schema.js';\n\n/**\n * Options for the check command.\n */\nexport interface CheckCommandOptions {\n /** Path to config file */\n config: string;\n /** Fail threshold: treat warnings as errors */\n failOn: 'warn' | 'error';\n /** Show detailed output */\n verbose: boolean;\n}\n\n/**\n * Executes the check command.\n * @param options - Command options\n * @returns Exit code\n */\nexport async function checkCommand(options: CheckCommandOptions): Promise<number> {\n const { config: configPath, failOn, verbose } = options;\n \n try {\n // Step 1: Load config\n if (verbose) {\n printVerbose(`Loading config from: ${configPath}`);\n }\n \n let loadResult: LoadConfigResult;\n try {\n loadResult = await loadConfig({ path: configPath });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n printError(`Failed to load config: ${message}`);\n return ExitCodes.CONFIG_NOT_FOUND;\n }\n \n const { config } = loadResult;\n \n // Report any validation issues\n for (const issue of loadResult.issues) {\n if (issue.severity === 'warning') {\n printWarning(issue.message);\n } else {\n printError(issue.message);\n return ExitCodes.INVALID_CONFIG;\n }\n }\n \n if (verbose) {\n printVerbose(`Config loaded successfully`);\n printVerbose(`Site: ${config.site.baseUrl}`);\n }\n \n // Step 2: Run checker\n if (verbose) {\n printVerbose('Running SEO checks...');\n }\n \n const checkOptions: CoreCheckOptions = {\n config,\n failOn,\n llmsTxtPath: config.output.paths.llmsTxt,\n llmsFullTxtPath: config.output.paths.llmsFullTxt,\n ...(config.output.paths.citations && { citationsPath: config.output.paths.citations }),\n };\n \n const result = await checkGeneratedFiles(checkOptions);\n\n const manifestItems = extractManifestItems(config);\n const canonicalUrls = createCanonicalUrlsFromManifest({\n items: manifestItems,\n baseUrl: config.site.baseUrl,\n defaultLocale: config.site.defaultLocale ?? config.brand.locales[0] ?? 'en',\n trailingSlash: config.format?.trailingSlash ?? 'never',\n localeStrategy: 'prefix',\n });\n const expectedLlms = createLlmsTxt({ config, canonicalUrls });\n const expectedLlmsFull = createLlmsFullTxt({\n config,\n canonicalUrls,\n manifestItems,\n });\n\n const requiredMissing = result.issues.some((issue) => {\n return (\n issue.code === 'file_missing' &&\n (issue.path === config.output.paths.llmsTxt ||\n issue.path === config.output.paths.llmsFullTxt)\n );\n });\n\n let merged = result;\n if (!requiredMissing) {\n const mismatchIssues = await checkFilesAgainstExpected(\n config.output.paths.llmsTxt,\n expectedLlms.content,\n config.output.paths.llmsFullTxt,\n expectedLlmsFull.content\n );\n\n if (mismatchIssues.length > 0) {\n const issues = [...result.issues, ...mismatchIssues];\n const counts = countSeverities(issues);\n const mismatchCount = mismatchIssues.filter((issue) => issue.code === 'file_mismatch').length;\n merged = {\n ...result,\n issues,\n summary: {\n ...result.summary,\n errors: counts.error,\n warnings: counts.warning,\n info: counts.info,\n filesMismatch: result.summary.filesMismatch + mismatchCount,\n },\n };\n }\n }\n \n // Step 3: Print report\n printCheckReport(merged, verbose);\n \n // Step 4: Return exit code\n if (merged.summary.errors > 0) {\n return ExitCodes.ERROR;\n }\n \n if (failOn === 'warn' && merged.summary.warnings > 0) {\n return ExitCodes.WARN;\n }\n \n return ExitCodes.OK;\n \n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n printError(`Check failed: ${message}`);\n return ExitCodes.ERROR;\n }\n}\n\n/**\n * Extracts manifest items from config.\n */\nfunction extractManifestItems(config: LlmsSeoConfig): ManifestItem[] {\n const items: ManifestItem[] = [];\n \n const manifests = config.manifests;\n \n for (const [_manifestName, manifestData] of Object.entries(manifests)) {\n if (typeof manifestData === 'object' && manifestData !== null) {\n const data = manifestData as Record<string, unknown>;\n \n if (Array.isArray(data.pages)) {\n for (const page of data.pages) {\n const normalized = toManifestItem(page);\n if (normalized) {\n items.push(normalized);\n }\n }\n }\n \n if (Array.isArray(data)) {\n for (const item of data) {\n const normalized = toManifestItem(item);\n if (normalized) {\n items.push(normalized);\n }\n }\n }\n }\n }\n \n return items;\n}\n\nfunction toManifestItem(value: unknown): ManifestItem | null {\n if (typeof value !== 'object' || value === null) {\n return null;\n }\n\n const data = value as Record<string, unknown>;\n const rawSlug = data.slug ?? data.path;\n if (typeof rawSlug !== 'string' || rawSlug.length === 0) {\n return null;\n }\n\n const item: ManifestItem = {\n slug: rawSlug.startsWith('/') ? rawSlug : `/${rawSlug}`,\n };\n\n if (typeof data.title === 'string') {\n item.title = data.title;\n }\n if (typeof data.description === 'string') {\n item.description = data.description;\n }\n if (Array.isArray(data.locales)) {\n const locales = data.locales.filter((loc): loc is string => typeof loc === 'string');\n if (locales.length > 0) {\n item.locales = locales;\n }\n }\n if (typeof data.canonicalOverride === 'string') {\n item.canonicalOverride = data.canonicalOverride;\n }\n if (typeof data.publishedAt === 'string') {\n item.publishedAt = data.publishedAt;\n }\n if (typeof data.updatedAt === 'string') {\n item.updatedAt = data.updatedAt;\n }\n if (typeof data.priority === 'number') {\n item.priority = data.priority;\n }\n\n return item;\n}\n","/**\n * Doctor command - diagnoses common issues with llm-seo setup.\n * Main implementation of `llm-seo doctor` CLI command.\n */\n\nimport type { LlmsSeoConfig } from '../../schema/config.schema.js';\nimport { loadConfig, findConfigFile } from '../io/load-config.js';\nimport {\n printVerbose,\n printDoctorReport,\n type DoctorCheck,\n} from '../io/report.js';\nimport { ExitCodes } from '../exit-codes.js';\n\n/**\n * Options for the doctor command.\n */\nexport interface DoctorOptions {\n /** Site URL to check (optional) */\n site?: string;\n /** Config file path (optional) */\n config?: string;\n /** Show detailed output */\n verbose: boolean;\n}\n\n/**\n * Executes the doctor command.\n * @param options - Command options\n * @returns Exit code\n */\nexport async function doctorCommand(options: DoctorOptions): Promise<number> {\n const { site: siteUrl, config: configPath, verbose } = options;\n \n console.log('Running llm-seo diagnostics...\\n');\n \n const checks: DoctorCheck[] = [];\n let config: LlmsSeoConfig | null = null;\n \n // Step 1: Check Node.js version\n checks.push(checkNodeVersion(verbose));\n \n // Step 2: Check for config file\n const configCheck = await checkConfigFile(configPath, verbose);\n checks.push(configCheck.check);\n \n // Load config if available\n if (configCheck.config) {\n config = configCheck.config;\n }\n \n // Step 3: Determine site URL\n let baseUrl = siteUrl;\n if (!baseUrl && config) {\n baseUrl = config.site.baseUrl;\n }\n \n // Step 4: Check endpoints if we have a URL\n if (baseUrl) {\n if (verbose) {\n printVerbose(`Checking site: ${baseUrl}`);\n }\n \n // Check standard endpoints\n checks.push(...await checkEndpoints(baseUrl, config, verbose));\n } else {\n checks.push({\n name: 'Site URL',\n url: '',\n status: 'warn',\n message: 'No site URL specified. Use --site or configure in config file.',\n });\n }\n \n // Step 5: Print report\n printDoctorReport(checks, verbose);\n \n // Step 6: Determine exit code\n const hasErrors = checks.some(c => c.status === 'error');\n const hasWarnings = checks.some(c => c.status === 'warn');\n \n if (hasErrors) {\n return ExitCodes.NETWORK_ERROR;\n }\n \n if (hasWarnings) {\n return ExitCodes.WARN;\n }\n \n return ExitCodes.OK;\n}\n\n/**\n * Checks Node.js version.\n */\nfunction checkNodeVersion(_verbose: boolean): DoctorCheck {\n const nodeVersion = process.version;\n const majorVersion = parseInt(nodeVersion.slice(1).split('.')[0] ?? '0', 10);\n \n if (majorVersion >= 18) {\n return {\n name: 'Node.js version',\n url: '',\n status: 'ok',\n message: `${nodeVersion} (supported)`,\n };\n }\n \n return {\n name: 'Node.js version',\n url: '',\n status: 'error',\n message: `${nodeVersion} (requires Node.js 18+)`,\n };\n}\n\n/**\n * Result of config file check.\n */\ninterface ConfigCheckResult {\n check: DoctorCheck;\n config: LlmsSeoConfig | null;\n}\n\n/**\n * Checks for config file and loads it if available.\n */\nasync function checkConfigFile(configPath: string | undefined, verbose: boolean): Promise<ConfigCheckResult> {\n // Try to find config file\n let foundPath = configPath;\n \n if (!foundPath) {\n foundPath = findConfigFile() ?? undefined;\n }\n \n if (!foundPath) {\n return {\n check: {\n name: 'Config file',\n url: '',\n status: 'warn',\n message: 'No config file found. Run from project directory or specify --config.',\n },\n config: null,\n };\n }\n \n if (verbose) {\n printVerbose(`Found config: ${foundPath}`);\n }\n \n // Try to load config\n try {\n const loadResult = await loadConfig({ path: foundPath });\n \n return {\n check: {\n name: 'Config file',\n url: foundPath,\n status: 'ok',\n message: `Loaded from ${foundPath}`,\n },\n config: loadResult.config,\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n \n return {\n check: {\n name: 'Config file',\n url: foundPath,\n status: 'error',\n message: `Invalid config: ${message}`,\n },\n config: null,\n };\n }\n}\n\n/**\n * Checks site endpoints.\n */\nasync function checkEndpoints(\n baseUrl: string,\n config: LlmsSeoConfig | null,\n verbose: boolean\n): Promise<DoctorCheck[]> {\n const checks: DoctorCheck[] = [];\n \n // Normalize base URL (remove trailing slash)\n const normalizedBaseUrl = baseUrl.replace(/\\/$/, '');\n \n // Check robots.txt\n const robotsUrl = config?.machineHints?.robots ?? `${normalizedBaseUrl}/robots.txt`;\n checks.push(await checkEndpoint('robots.txt', robotsUrl, verbose));\n \n // Check sitemap.xml\n const sitemapUrl = config?.machineHints?.sitemap ?? `${normalizedBaseUrl}/sitemap.xml`;\n checks.push(await checkEndpoint('sitemap.xml', sitemapUrl, verbose));\n \n // Check sitemap-index.xml (try both standard paths)\n const sitemapIndexUrl = `${normalizedBaseUrl}/sitemap-index.xml`;\n const sitemapIndexCheck = await checkEndpoint('sitemap-index.xml', sitemapIndexUrl, verbose, true);\n if (sitemapIndexCheck.status === 'error') {\n sitemapIndexCheck.status = 'skip';\n sitemapIndexCheck.message = 'Not found (optional)';\n }\n checks.push(sitemapIndexCheck);\n \n // Check llms.txt\n const llmsTxtUrl = config?.machineHints?.llmsTxt ?? `${normalizedBaseUrl}/llms.txt`;\n checks.push(await checkEndpoint('llms.txt', llmsTxtUrl, verbose));\n \n // Check llms-full.txt\n const llmsFullTxtUrl = config?.machineHints?.llmsFullTxt ?? `${normalizedBaseUrl}/llms-full.txt`;\n checks.push(await checkEndpoint('llms-full.txt', llmsFullTxtUrl, verbose));\n \n return checks;\n}\n\n/**\n * Fetches URL and returns check result.\n * @param name - Endpoint name for display\n * @param url - Full URL to check\n * @param verbose - Show detailed output\n * @param optional - Whether this endpoint is optional (affects error handling)\n * @returns Doctor check result\n */\nasync function checkEndpoint(\n name: string,\n url: string,\n _verbose: boolean,\n optional = false\n): Promise<DoctorCheck> {\n const startTime = Date.now();\n \n try {\n // Use native fetch (Node.js 18+)\n const response = await fetch(url, {\n method: 'GET',\n signal: AbortSignal.timeout(10000), // 10 second timeout\n });\n \n const responseTime = Date.now() - startTime;\n \n if (response.ok) {\n return {\n name,\n url,\n status: 'ok',\n message: 'OK',\n responseTime,\n };\n }\n \n if (response.status === 404) {\n return {\n name,\n url,\n status: optional ? 'skip' : 'error',\n message: optional ? 'Not found (optional)' : 'HTTP 404 Not Found',\n responseTime,\n };\n }\n \n return {\n name,\n url,\n status: 'error',\n message: `HTTP ${response.status} ${response.statusText}`,\n responseTime,\n };\n \n } catch (error) {\n const responseTime = Date.now() - startTime;\n const message = error instanceof Error ? error.message : String(error);\n \n // Handle specific error types\n if (message.includes('fetch failed') || message.includes('ENOTFOUND')) {\n return {\n name,\n url,\n status: 'error',\n message: 'Connection failed (DNS or network error)',\n responseTime,\n };\n }\n \n if (message.includes('timeout') || message.includes('Timeout')) {\n return {\n name,\n url,\n status: 'error',\n message: 'Request timed out (10s)',\n responseTime,\n };\n }\n \n return {\n name,\n url,\n status: optional ? 'skip' : 'error',\n message: optional ? 'Not available' : `Failed: ${message}`,\n responseTime,\n };\n }\n}\n","#!/usr/bin/env node\n/**\n * CLI entry point for llm-seo.\n * Main entry point for the `llm-seo` command line tool.\n * \n * Commands:\n * - generate: Generate llms.txt and llms-full.txt from config\n * - check: Validate generated files against config\n * - doctor: Diagnose common issues with llm-seo setup\n */\n\nimport { Command } from 'commander';\nimport { ExitCodes } from './exit-codes.js';\n\n// Import version from package.json\nconst VERSION = '0.1.0';\n\nconst program = new Command();\n\nprogram\n .name('llm-seo')\n .description('Deterministic LLM SEO artifacts generator and validator for modern static sites')\n .version(VERSION)\n .option('-c, --config <path>', 'Path to config file', 'llm-seo.config.ts')\n .option('-v, --verbose', 'Enable verbose output', false);\n\n// ========================================\n// Generate Command\n// ========================================\nprogram\n .command('generate')\n .description('Generate llms.txt and llms-full.txt from site configuration')\n .option('-c, --config <path>', 'Path to config file')\n .option('--dry-run', 'Output to stdout instead of writing files', false)\n .option('--emit-citations', 'Generate citations.json file', false)\n .option('-v, --verbose', 'Show detailed progress', false)\n .action(async (options) => {\n const { generateCommand } = await import('./commands/generate.js');\n const exitCode = await generateCommand({\n config: options.config ?? program.opts().config,\n dryRun: options.dryRun ?? false,\n emitCitations: options.emitCitations ?? false,\n verbose: options.verbose ?? program.opts().verbose ?? false,\n });\n process.exit(exitCode);\n });\n\n// ========================================\n// Check Command\n// ========================================\nprogram\n .command('check')\n .description('Validate generated llms.txt files against configuration')\n .option('-c, --config <path>', 'Path to config file')\n .option('--fail-on <level>', 'Fail on warnings (warn) or only errors (error)', 'error')\n .option('-v, --verbose', 'Show detailed output', false)\n .action(async (options) => {\n const { checkCommand } = await import('./commands/check.js');\n \n // Validate fail-on option\n const failOn = options.failOn as 'warn' | 'error';\n if (failOn !== 'warn' && failOn !== 'error') {\n console.error(`Invalid --fail-on value: ${options.failOn}. Must be 'warn' or 'error'.`);\n process.exit(ExitCodes.ERROR);\n }\n \n const exitCode = await checkCommand({\n config: options.config ?? program.opts().config,\n failOn,\n verbose: options.verbose ?? program.opts().verbose ?? false,\n });\n process.exit(exitCode);\n });\n\n// ========================================\n// Doctor Command\n// ========================================\nprogram\n .command('doctor')\n .description('Diagnose common issues with llm-seo setup and site endpoints')\n .option('-s, --site <url>', 'Site URL to check (e.g., https://example.com)')\n .option('-c, --config <path>', 'Path to config file')\n .option('-v, --verbose', 'Show detailed output', false)\n .action(async (options) => {\n const { doctorCommand } = await import('./commands/doctor.js');\n const exitCode = await doctorCommand({\n site: options.site,\n config: options.config ?? program.opts().config,\n verbose: options.verbose ?? program.opts().verbose ?? false,\n });\n process.exit(exitCode);\n });\n\n// ========================================\n// Help Command (custom)\n// ========================================\nprogram\n .command('help [command]')\n .description('Display help for a specific command')\n .action((commandName) => {\n if (commandName) {\n const command = program.commands.find((cmd) => cmd.name() === commandName);\n if (command) {\n command.outputHelp();\n } else {\n console.error(`Unknown command: ${commandName}`);\n process.exit(ExitCodes.COMMAND_NOT_FOUND);\n }\n } else {\n program.outputHelp();\n }\n });\n\n// ========================================\n// Error handling\n// ========================================\n\n// Handle unknown commands\nprogram.on('command:*', () => {\n console.error('Invalid command: %s\\nSee --help for a list of available commands.', program.args.join(' '));\n process.exit(ExitCodes.COMMAND_NOT_FOUND);\n});\n\n// Parse arguments and run\nprogram.parse(process.argv);\n\n// Show help if no command provided\nif (!process.argv.slice(2).length) {\n program.outputHelp();\n}\n"]}