opengrep 1.1.0

Advanced AST-aware code search tool with tree-sitter parsing and AI integration capabilities
Documentation
//! AI-powered search pattern suggestions

use serde::{Deserialize, Serialize};

/// A single search pattern suggestion.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PatternSuggestion {
    /// The suggested search pattern.
    pub pattern: String,
    /// A description of what the pattern does and why it's useful.
    pub description: String,
    /// Confidence in the suggestion's relevance (0.0 to 1.0).
    pub confidence: f32,
    /// Whether this is a regular expression pattern.
    pub regex: bool,
    /// The type of suggestion (e.g., "BROADER", "MORE_SPECIFIC", "REGEX_EQUIVALENT").
    pub suggestion_type: SuggestionType,
    /// Example code snippet where this pattern would be useful.
    pub example: Option<String>,
}

/// The type of suggestion.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum SuggestionType {
    /// A more general pattern that might find more results.
    Broader,
    /// A more specific pattern to narrow down results.
    MoreSpecific,
    /// A regular expression version of a literal search.
    RegexEquivalent,
    /// An alternative pattern that might find related results.
    Alternative,
    /// An AST-based pattern suggestion.
    AstBased,
    /// A pattern targeting a potential typo or variation.
    Typo,
    /// A pattern based on common coding practices.
    Convention,
}