{"record":{"id":"333c04d9f573a6e1","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":"skill/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/f88b2837a7d7c3182e46307bbbb091a1ed547571/skill/scripts/hook-admin.mjs#L591-L627","documentation":"Thrown by parseIgnoreFileArgs when both --shared and --local are passed to `hooks ignore-file`. The two flags select which config file receives the glob (shared project config vs local personal config); they are mutually exclusive and the parser cannot write to both, so it refuses rather than picking one silently.","triggerScenarios":"`hooks ignore-file \"src/**\" --shared --local`; scripts assembling flags from multiple toggles that both end up true; users hedging because they are unsure which scope they want.","commonSituations":"Wrapper scripts that OR together boolean options into one command line; copy-paste accumulation of flags across attempts.","solutions":["Keep exactly one scope flag: --shared for the committed project config, --local for your personal gitignored config.","Omit both to use the default shared scope.","If you need the glob in both scopes, run the command twice."],"exampleFix":"# before\nimpeccable hooks ignore-file \"src/legacy/**\" --shared --local\n\n# after\nimpeccable hooks ignore-file \"src/legacy/**\" --shared\nimpeccable hooks ignore-file \"src/legacy/**\" --local   # separate run if truly needed","handlingStrategy":"validation","validationCode":"function scopeFlags({ shared, local }) {\n  if (shared && local) throw new Error('choose exactly one scope');\n  if (local) return ['--local'];\n  if (shared) return ['--shared'];\n  return []; // default shared\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model scope as a single enum (shared|local|default) in wrapper code, never two independent booleans.","Running the command twice is the correct way to write a glob to both configs."],"tags":["cli","conflicting-flags","hook-admin","ignore-file"],"backgroundTag":"conflicting-flag-combination","analyzedSha":"f88b2837a7d7c3182e46307bbbb091a1ed547571","analyzedAt":"2026-08-18T04:58:36.608Z","contentChangedAt":"2026-08-18T04:58:36.608Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}