{"record":{"id":"cae90338ba76946b","repo":"pbakaus/impeccable","slug":"pass-a-glob-e-g-impeccable-command-hooks-igno-cae903","errorCode":null,"errorMessage":"Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file \"src/legacy/**\"","messagePattern":"Pass a glob, e\\.g\\. (.+?) hooks ignore-file \"src/legacy/\\*\\*\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skill/scripts/hook-admin.mjs","lineNumber":621,"sourceCode":"      throw new Error(`Unknown ignore-file flag: ${arg}`);\n    } else {\n      positionals.push(arg);\n    }\n  }\n\n  if (shared && local) throw new Error('Pass only one scope flag: --shared or --local');\n  if (positionals.length > 1) throw new Error('Pass exactly one glob to ignore-file');\n\n  return {\n    glob: positionals[0],\n    local,\n  };\n}\n\nfunction addIgnoreFile(cwd, args) {\n  const parsed = parseIgnoreFileArgs(args);\n  const glob = parsed.glob;\n  if (!glob) throw new Error(`Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file \"src/legacy/**\"`);\n  const config = mergeDetectorConfig(readRawDetectorConfig(cwd, { local: parsed.local }));\n  if (!config.ignoreFiles.includes(glob)) config.ignoreFiles.push(glob);\n  const target = writeDetectorConfig(cwd, config, { local: parsed.local });\n  const scope = parsed.local ? 'local detector.ignoreFiles' : 'shared detector.ignoreFiles';\n  return `Added \"${glob}\" to ${scope} (${path.relative(cwd, target) || target}). Current: ${config.ignoreFiles.join(', ')}`;\n}\n\n// An empty glob used to be dropped by filter(Boolean), so `--file=` reported\n// success and wrote an entry with no files: the user asked to scope a rule to one\n// file and silently got the project-wide suppression instead. Refuse it.\nfunction requireGlob(raw, flag) {\n  const glob = String(raw ?? '').trim();\n  if (!glob) throw new Error(`${flag} requires a non-empty glob`);\n  // A following flag is not a glob. `--file --reason \"why\"` consumed `--reason`\n  // as the scope and left the reason text to fold into the value, storing\n  // value=\"* why\" files=[\"--reason\"] and reporting success. Same silent-no-op\n  // class as an unknown flag folding into the value; refuse it the same way.\n  if (glob.startsWith('--')) throw new Error(`${flag} requires a glob, got the flag ${glob}`);","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/skill/scripts/hook-admin.mjs#L603-L639","documentation":"Thrown by addIgnoreFile when no glob was supplied (parsed.glob is falsy). ignore-file requires exactly one positional: the glob pattern to add to detector.ignoreFiles. Running it with only flags, or with no arguments, is rejected with a concrete example. An earlier guard (requireGlob) separately rejects empty globs from `--file=`.","triggerScenarios":"Running `impeccable hooks ignore-file` with no positional; passing only --shared/--local; a glob that trims to empty.","commonSituations":"Forgetting the glob; assuming the command reads from stdin; a wrapper script that drops the positional; quoting that collapses to nothing.","solutions":["Pass exactly one glob as the first positional, e.g. `impeccable hooks ignore-file \"src/legacy/**\"`.","Quote globs so the shell does not expand them.","Make sure the glob is non-empty (empty globs are rejected even when provided via --file=)."],"exampleFix":"# before\nimpeccable hooks ignore-file --shared\n\n# after\nimpeccable hooks ignore-file \"src/legacy/**\" --shared","handlingStrategy":"validation","validationCode":"// Ensure a non-empty glob positional is present before calling addIgnoreFile.\nfunction requireIgnoreFileGlob(positionals) {\n  const glob = String(positionals[0] ?? '').trim();\n  if (!glob) {\n    throw new Error('Pass a glob, e.g. impeccable hooks ignore-file \"src/legacy/**\"');\n  }\n  return glob;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass exactly one glob positional to ignore-file, quoted so the shell cannot expand it.","Make the glob non-empty; `--file=` is rejected separately by requireGlob.","If scripting, assert the positional is non-empty before invoking."],"tags":["cli","hooks","validation","config","usage"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}