vectordb-cli 1.6.0

A CLI tool for semantic code search.
// This file is @generated by prost-build.
/// Shared structure for identifying the target of an edit
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EditTarget {
    #[prost(oneof = "edit_target::TargetType", tags = "1, 2")]
    pub target_type: ::core::option::Option<edit_target::TargetType>,
}
/// Nested message and enum types in `EditTarget`.
pub mod edit_target {
    #[allow(clippy::derive_partial_eq_without_eq)]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum TargetType {
        #[prost(message, tag = "1")]
        LineRange(super::LineRange),
        #[prost(message, tag = "2")]
        SemanticElement(super::SemanticElement),
    }
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LineRange {
    /// 1-based inclusive
    #[prost(uint32, tag = "1")]
    pub start_line: u32,
    /// 1-based inclusive
    #[prost(uint32, tag = "2")]
    pub end_line: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SemanticElement {
    /// e.g., "function:process_data", "class:User.method:auth"
    #[prost(string, tag = "1")]
    pub element_query: ::prost::alloc::string::String,
}
/// Shared structure for edit options
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EditOptions {
    /// Attempt to update references to the edited element
    #[prost(bool, tag = "1")]
    pub update_references: bool,
    /// Keep associated docstrings/comments (best effort)
    #[prost(bool, tag = "2")]
    pub preserve_documentation: bool,
    /// Apply formatting consistent with the file
    #[prost(bool, tag = "3")]
    pub format_code: bool,
}
/// Request for EditCode RPC
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EditCodeRequest {
    /// Absolute or relative path to the file
    #[prost(string, tag = "1")]
    pub file_path: ::prost::alloc::string::String,
    /// How to identify the code to edit
    #[prost(message, optional, tag = "2")]
    pub target: ::core::option::Option<EditTarget>,
    /// The new code content
    #[prost(string, tag = "3")]
    pub content: ::prost::alloc::string::String,
    /// Options controlling the edit behavior
    #[prost(message, optional, tag = "4")]
    pub options: ::core::option::Option<EditOptions>,
}
/// Response for EditCode RPC
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EditCodeResponse {
    /// True if the edit was applied successfully
    #[prost(bool, tag = "1")]
    pub success: bool,
    /// Details if the edit failed
    #[prost(string, optional, tag = "2")]
    pub error_message: ::core::option::Option<::prost::alloc::string::String>,
    /// List of elements potentially modified (e.g., updated references)
    #[prost(string, repeated, tag = "3")]
    pub affected_elements: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Request for ValidateEdit RPC (mirrors EditCodeRequest)
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidateEditRequest {
    #[prost(string, tag = "1")]
    pub file_path: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub target: ::core::option::Option<EditTarget>,
    #[prost(string, tag = "3")]
    pub content: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub options: ::core::option::Option<EditOptions>,
}
/// Response for ValidateEdit RPC
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidateEditResponse {
    /// True if the edit passes validation checks
    #[prost(bool, tag = "1")]
    pub is_valid: bool,
    /// List of potential issues found
    #[prost(message, repeated, tag = "2")]
    pub issues: ::prost::alloc::vec::Vec<ValidationIssue>,
}
/// Represents a specific validation issue
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidationIssue {
    /// How critical the issue is
    #[prost(enumeration = "validation_issue::Severity", tag = "1")]
    pub severity: i32,
    /// Description of the issue
    #[prost(string, tag = "2")]
    pub message: ::prost::alloc::string::String,
    /// Approximate line number related to the issue
    #[prost(uint32, optional, tag = "3")]
    pub line_number: ::core::option::Option<u32>,
}
/// Nested message and enum types in `ValidationIssue`.
pub mod validation_issue {
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum Severity {
        Info = 0,
        Warning = 1,
        Error = 2,
    }
    impl Severity {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Severity::Info => "INFO",
                Severity::Warning => "WARNING",
                Severity::Error => "ERROR",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "INFO" => Some(Self::Info),
                "WARNING" => Some(Self::Warning),
                "ERROR" => Some(Self::Error),
                _ => None,
            }
        }
    }
}
/// Generated server implementations.
pub mod editing_service_server {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with EditingServiceServer.
    #[async_trait]
    pub trait EditingService: Send + Sync + 'static {
        /// Applies a code edit to a specified file
        async fn edit_code(
            &self,
            request: tonic::Request<super::EditCodeRequest>,
        ) -> std::result::Result<
            tonic::Response<super::EditCodeResponse>,
            tonic::Status,
        >;
        /// Validates a potential code edit without applying it
        async fn validate_edit(
            &self,
            request: tonic::Request<super::ValidateEditRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ValidateEditResponse>,
            tonic::Status,
        >;
    }
    /// Service definition for code editing operations
    #[derive(Debug)]
    pub struct EditingServiceServer<T: EditingService> {
        inner: _Inner<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    struct _Inner<T>(Arc<T>);
    impl<T: EditingService> EditingServiceServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            let inner = _Inner(inner);
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.max_decoding_message_size = Some(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for EditingServiceServer<T>
    where
        T: EditingService,
        B: Body + Send + 'static,
        B::Error: Into<StdError> + Send + 'static,
    {
        type Response = http::Response<tonic::body::BoxBody>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            let inner = self.inner.clone();
            match req.uri().path() {
                "/editing.EditingService/EditCode" => {
                    #[allow(non_camel_case_types)]
                    struct EditCodeSvc<T: EditingService>(pub Arc<T>);
                    impl<
                        T: EditingService,
                    > tonic::server::UnaryService<super::EditCodeRequest>
                    for EditCodeSvc<T> {
                        type Response = super::EditCodeResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::EditCodeRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as EditingService>::edit_code(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = EditCodeSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/editing.EditingService/ValidateEdit" => {
                    #[allow(non_camel_case_types)]
                    struct ValidateEditSvc<T: EditingService>(pub Arc<T>);
                    impl<
                        T: EditingService,
                    > tonic::server::UnaryService<super::ValidateEditRequest>
                    for ValidateEditSvc<T> {
                        type Response = super::ValidateEditResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::ValidateEditRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as EditingService>::validate_edit(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = ValidateEditSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        Ok(
                            http::Response::builder()
                                .status(200)
                                .header("grpc-status", "12")
                                .header("content-type", "application/grpc")
                                .body(empty_body())
                                .unwrap(),
                        )
                    })
                }
            }
        }
    }
    impl<T: EditingService> Clone for EditingServiceServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    impl<T: EditingService> Clone for _Inner<T> {
        fn clone(&self) -> Self {
            Self(Arc::clone(&self.0))
        }
    }
    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
            write!(f, "{:?}", self.0)
        }
    }
    impl<T: EditingService> tonic::server::NamedService for EditingServiceServer<T> {
        const NAME: &'static str = "editing.EditingService";
    }
}