Skip to main content

pack_aware_quick_reject

Function pack_aware_quick_reject 

Source
pub fn pack_aware_quick_reject(cmd: &str, enabled_keywords: &[&str]) -> bool
Expand description

Pack-aware quick-reject filter.

Returns true if the command can be safely skipped (contains none of the provided keywords from enabled packs).

This is the correct function to use when non-core packs are enabled. It checks all keywords from enabled packs, not just “git” and “rm”.

§Performance

Uses SIMD-accelerated substring search via memchr as a fast prefilter, then applies token-aware checks inside executable spans (via context classification) to avoid substring false triggers.

§Arguments

  • cmd - The command string to check
  • enabled_keywords - Keywords from all enabled packs (from PackRegistry::collect_enabled_keywords)

§Returns

true if the command contains NO keywords (safe to skip pack checking) false if the command contains at least one keyword (must check packs)