{"record":{"id":"9a5e95c9b56a93a7","repo":"pbakaus/impeccable","slug":"config-cspchecked-if-present-must-be-a-boolean-9a5e95","errorCode":null,"errorMessage":"config.cspChecked, if present, must be a boolean","messagePattern":"config\\.cspChecked, if present, must be a boolean","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skill/scripts/live-inject.mjs","lineNumber":472,"sourceCode":"  if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {\n    throw new Error('config.files must contain only non-empty strings');\n  }\n  if (cfg.exclude !== undefined) {\n    if (!Array.isArray(cfg.exclude)) {\n      throw new Error('config.exclude, if present, must be a string array');\n    }\n    if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {\n      throw new Error('config.exclude must contain only non-empty strings');\n    }\n  }\n  if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {\n    throw new Error('config.insertBefore or config.insertAfter (string) required');\n  }\n  if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {\n    throw new Error(\"config.commentSyntax must be 'html' or 'jsx'\");\n  }\n  if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {\n    throw new Error(\"config.cspChecked, if present, must be a boolean\");\n  }\n}\n\n// ---------------------------------------------------------------------------\n// Auto-execute\n// ---------------------------------------------------------------------------\n\nconst _running = process.argv[1];\nif (_running?.endsWith('live-inject.mjs') || _running?.endsWith('live-inject.mjs/')) {\n  enterLiveRoot();\n  injectCli();\n}\n\n// Re-exported so long-standing importers (live.mjs, the adapter modules, the\n// test suites) keep their entry points while the implementations live in\n// live/frameworks/.\nexport {\n  buildLiveScriptSrc,","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/skill/scripts/live-inject.mjs#L454-L490","documentation":"Thrown by validateConfig() in live-inject.mjs when cfg.cspChecked is present but not a boolean. cspChecked is an optional flag indicating the author has already verified the injected snippet against the page's Content-Security-Policy; the guard only rejects wrong-typed values (string 'true', number 1), undefined is allowed. It runs before any file writes.","triggerScenarios":"validateConfig runs on a config containing \"cspChecked\": \"true\", \"cspChecked\": 1, or \"cspChecked\": \"yes\". The undefined case (key absent) is valid and means 'not yet checked'.","commonSituations":"Config generated by a tool that serializes booleans as strings; author wrote cspChecked: \"true\" in a JSON template; copy-paste from YAML configs that coerce unquoted true to string.","solutions":["Set 'cspChecked' to a real JSON boolean: \"cspChecked\": true (or false).","If you have not done a CSP review, omit the key entirely rather than passing a placeholder."],"exampleFix":"// before\n\"cspChecked\": \"true\"\n// after\n\"cspChecked\": true","handlingStrategy":"type-guard","validationCode":"if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {\n  // coerce common mistakes\n  cfg.cspChecked = cfg.cspChecked === 'true' || cfg.cspChecked === 1;\n}","typeGuard":"function isOptionalBoolean(v: unknown): v is boolean | undefined {\n  return v === undefined || typeof v === 'boolean';\n}","tryCatchPattern":null,"preventionTips":["Always emit booleans as bare true/false in JSON, never quoted.","If a generator serializes booleans as strings, fix the generator rather than patching config.","Omit cspChecked when unsure rather than passing a placeholder."],"tags":["config","validation","live-inject","csp","boolean"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}