{"record":{"id":"0614a58ed675046c","repo":"pbakaus/impeccable","slug":"pass-only-one-scope-flag-shared-or-local","errorCode":null,"errorMessage":"Pass only one scope flag: --shared or --local","messagePattern":"Pass only one scope flag: --shared or --local","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/skills/impeccable/scripts/hook-admin.mjs","lineNumber":609,"sourceCode":"  let shared = false;\n  let local = false;\n\n  for (const raw of args) {\n    const arg = String(raw || '');\n    if (arg === '--shared') {\n      shared = true;\n    } else if (arg === '--local') {\n      local = true;\n    } else if (arg === '--reason' || arg.startsWith('--reason=')) {\n      throw new Error('--reason is not supported for ignore-file because detector.ignoreFiles stores globs only; use ignore-value when a documented rule-specific exception fits');\n    } else if (arg.startsWith('--')) {\n      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}","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/hook-admin.mjs#L591-L627","documentation":"ignore-file's scope is a single choice: `--shared` writes to the committed detector config and `--local` writes to a gitignored local config. Setting both is contradictory, so the parser rejects it after collecting args. (This check is shared with ignore-value, which throws the identical message.)","triggerScenarios":"Running `hooks ignore-file \"<glob>\" --shared --local`.","commonSituations":"Passing both flags by mistake; a wrapper script that always appends a scope flag colliding with one the user also set.","solutions":["Pass exactly one scope flag — either --shared or --local (or neither for the default)."],"exampleFix":"# before\nimpeccable hooks ignore-file \"src/legacy/**\" --shared --local\n\n# after\nimpeccable hooks ignore-file \"src/legacy/**\" --shared","handlingStrategy":"validation","validationCode":"if (args.includes('--shared') && args.includes('--local')) {\n  throw new Error('Pass only one scope flag: --shared or --local');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one scope per call; default (no flag) writes shared.","In wrapper scripts, set scope from a single variable, not two independent flags."],"tags":["cli","argument-parsing","detector-config"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}