Skip to content

fix: reject unknown ignore targets - #12

Merged
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
mikemikimike:codex/issue-9-validate-targets
Sep 6, 2026
Merged

fix: reject unknown ignore targets#12
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
mikemikimike:codex/issue-9-validate-targets

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Summary

Reject unknown --targets values before scanning or writing ignore files.

Problem

An invalid target such as bogus was silently filtered out, so --write could exit successfully without writing any ignore file.

Changes

  • Validate every non-empty target against the supported cursor, gemini, and generic targets.
  • Return exit code 2 with the invalid values and valid target list before scanning or writing.
  • Add a regression test covering an unknown target mixed with a valid target and bump the package version to 0.1.3 with a changelog entry.

Tests

  • npm test (9 passed)
  • node bin/ctxtrim.js test/fixtures/sample-repo --format json
  • node --check src/cli.js
  • node --check test/ctxtrim.test.js

Compatibility / Known limitations

Valid target names and existing report behavior are unchanged. Unknown targets now fail fast with exit code 2 and no ignore files are written.

Closes #9

@royalpinto007
royalpinto007 merged commit 7ee48ab into AgentPostmortem:main Sep 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown --targets values silently discarded, --write becomes a misleading no-op

2 participants