pbakaus/impeccable · error

Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file "s

Error message

Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file "src/legacy/**"

What it means

addIgnoreFile() requires one positional: the glob to add to detector.ignoreFiles. If parseIgnoreFileArgs returns an empty glob (no positional supplied), the command refuses rather than writing an empty entry that would scope nothing.

Source

Thrown at plugin/skills/impeccable/scripts/hook-admin.mjs:621

      throw new Error(`Unknown ignore-file flag: ${arg}`);
    } else {
      positionals.push(arg);
    }
  }

  if (shared && local) throw new Error('Pass only one scope flag: --shared or --local');
  if (positionals.length > 1) throw new Error('Pass exactly one glob to ignore-file');

  return {
    glob: positionals[0],
    local,
  };
}

function addIgnoreFile(cwd, args) {
  const parsed = parseIgnoreFileArgs(args);
  const glob = parsed.glob;
  if (!glob) throw new Error(`Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file "src/legacy/**"`);
  const config = mergeDetectorConfig(readRawDetectorConfig(cwd, { local: parsed.local }));
  if (!config.ignoreFiles.includes(glob)) config.ignoreFiles.push(glob);
  const target = writeDetectorConfig(cwd, config, { local: parsed.local });
  const scope = parsed.local ? 'local detector.ignoreFiles' : 'shared detector.ignoreFiles';
  return `Added "${glob}" to ${scope} (${path.relative(cwd, target) || target}). Current: ${config.ignoreFiles.join(', ')}`;
}

// An empty glob used to be dropped by filter(Boolean), so `--file=` reported
// success and wrote an entry with no files: the user asked to scope a rule to one
// file and silently got the project-wide suppression instead. Refuse it.
function requireGlob(raw, flag) {
  const glob = String(raw ?? '').trim();
  if (!glob) throw new Error(`${flag} requires a non-empty glob`);
  // A following flag is not a glob. `--file --reason "why"` consumed `--reason`
  // as the scope and left the reason text to fold into the value, storing
  // value="* why" files=["--reason"] and reporting success. Same silent-no-op
  // class as an unknown flag folding into the value; refuse it the same way.
  if (glob.startsWith('--')) throw new Error(`${flag} requires a glob, got the flag ${glob}`);

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Provide exactly one glob positional, e.g. `hooks ignore-file "src/legacy/**"`.

Example fix

# before
impeccable hooks ignore-file

# after
impeccable hooks ignore-file "src/legacy/**"
Defensive patterns

Strategy: validation

Validate before calling

const glob = positionals[0];
if (!glob) {
  throw new Error('Pass a glob, e.g. /impeccable hooks ignore-file "src/legacy/**"');
}

Type guard

function hasGlob(positionalZero) {
  return typeof positionalZero === 'string' && positionalZero.trim() !== '';
}

Prevention

When it happens

Trigger: Running `hooks ignore-file` with no positional, or with only flags (e.g. `hooks ignore-file --shared`).

Common situations: Forgetting the glob; a templated command that omits the path under some condition.

Related errors


AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13). Data as JSON: /api/errors/f9a4336ff8d01312. Report an issue: GitHub.