Skip to content

feat(cli): add --min-severity filtering option#9

Merged
NhanAZ merged 1 commit into
mainfrom
agent/severity-filtering
Jun 9, 2026
Merged

feat(cli): add --min-severity filtering option#9
NhanAZ merged 1 commit into
mainfrom
agent/severity-filtering

Conversation

@NhanAZ

@NhanAZ NhanAZ commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

What changed

Added a new --min-severity <level> CLI option to filter out findings below a certain severity threshold. Supported levels are info, warning, and error.

Why

When scanning large repositories, users may want to focus only on critical risks (e.g., hardcoded credentials) rather than being distracted by lower-severity warnings (e.g., prompt artifacts or unpinned dependencies). This allows integrating OPK more strictly into CI pipelines where --min-severity error would fail the build, but warnings would not clutter the output.

Testing

  • Unit tests added to tests/scanner/scanner.test.ts to verify findings are correctly filtered.
  • Manual CLI test confirms that running opk scan --min-severity error on the prompt-artifacts fixture (which only contains warnings) returns 0 findings.
  • Total tests passed: 40/40.

Risks

None. This strictly reduces the volume of reported findings when the flag is used. The default behavior (no flag provided) remains unchanged (reports all findings with level >= info).

Follow-up

Consider adding file/path exclusion patterns next.

@NhanAZ NhanAZ merged commit 89c8cb9 into main Jun 9, 2026
@NhanAZ NhanAZ deleted the agent/severity-filtering branch June 9, 2026 16:11
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.

1 participant