Skip to content

feat: standardized CommandMatcher enum for output filters #439

@bug-ops

Description

@bug-ops

Parent

Epic #426, Plan: .local/plan/m26.1-output-filtering-improvements.md
Priority: P0 (blocks Phase 1)

Problem

Current fn matches(&self, command: &str) -> bool is ambiguous — no standard way to express matching logic for cargo test vs cargo nextest run, git status --porcelain vs git status, etc.

Design

pub enum CommandMatcher {
    Exact(&'static str),
    Prefix(&'static str),
    Regex(regex::Regex),
    Custom(Box<dyn Fn(&str) -> bool + Send + Sync>),
}

Updated OutputFilter trait returns &CommandMatcher via matcher() method. Registry uses filter.matcher().matches(command).

Acceptance Criteria

  • CommandMatcher enum with 4 variants and matches() method
  • Unit tests for each variant
  • OutputFilter trait updated to use new matcher
  • Registry uses new matcher
  • Integration test for filter matching expected commands

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolsTool execution and MCP integration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions