rename crate again to signal-gateway-code-tool
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
//! Extended configuration for application source code browsing.
|
||||
|
||||
use serde::Deserialize;
|
||||
use signal_gateway_repo_code::{RepoCode, RepoCodeConfig, ShaCallback};
|
||||
use signal_gateway_code_tool::{CodeTool, CodeToolConfig, ShaCallback};
|
||||
use std::sync::Arc;
|
||||
use tracing::warn;
|
||||
use url::Url;
|
||||
|
||||
/// Extended configuration for RepoCode with HTTP-based SHA fetching.
|
||||
/// Extended configuration for CodeTool with HTTP-based SHA fetching.
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct RepoCodeConfigExt {
|
||||
/// The base RepoCode configuration.
|
||||
pub struct CodeToolConfigExt {
|
||||
/// The base CodeTool configuration.
|
||||
#[serde(flatten)]
|
||||
pub config: RepoCodeConfig,
|
||||
pub config: CodeToolConfig,
|
||||
/// URL to GET the current deployed version SHA.
|
||||
pub version_sha_http_get: Url,
|
||||
}
|
||||
|
||||
impl RepoCodeConfigExt {
|
||||
/// Convert to an RepoCode instance with HTTP-based SHA callback.
|
||||
pub fn into_app_code(self) -> Result<RepoCode, std::io::Error> {
|
||||
impl CodeToolConfigExt {
|
||||
/// Convert to an CodeTool instance with HTTP-based SHA callback.
|
||||
pub fn into_app_code(self) -> Result<CodeTool, std::io::Error> {
|
||||
let url = self.version_sha_http_get.clone();
|
||||
let client = reqwest::Client::new();
|
||||
|
||||
@@ -66,6 +66,6 @@ impl RepoCodeConfigExt {
|
||||
})
|
||||
});
|
||||
|
||||
RepoCode::new(self.config, sha_callback)
|
||||
CodeTool::new(self.config, sha_callback)
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use conf::Conf;
|
||||
use metrics_exporter_prometheus::PrometheusBuilder;
|
||||
use signal_gateway::{CommandRouter, Gateway, GatewayConfig, Handling};
|
||||
use signal_gateway_assistant_claude::{ClaudeAssistant, ClaudeConfig};
|
||||
use signal_gateway_repo_code::RepoCodeTools;
|
||||
use signal_gateway_code_tool::CodeToolTools;
|
||||
use std::{env, fs, net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
use tokio::net::TcpListener;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
@@ -16,8 +16,8 @@ use tracing_subscriber::EnvFilter;
|
||||
mod admin_http;
|
||||
use admin_http::AdminHttpConfig;
|
||||
|
||||
mod repo_code;
|
||||
use repo_code::RepoCodeConfigExt;
|
||||
mod code_tool;
|
||||
use code_tool::CodeToolConfigExt;
|
||||
|
||||
mod listen_http;
|
||||
use listen_http::start_http_task;
|
||||
@@ -51,7 +51,7 @@ pub struct Config {
|
||||
admin_http: Option<AdminHttpConfig>,
|
||||
/// Application source code configurations for Claude tools.
|
||||
#[conf(long, env, value_parser = serde_json::from_str, default, default_help_str = "[]")]
|
||||
app_code: Vec<RepoCodeConfigExt>,
|
||||
app_code: Vec<CodeToolConfigExt>,
|
||||
/// Claude API configuration for AI-powered responses.
|
||||
#[conf(flatten, prefix)]
|
||||
claude: Option<ClaudeConfig>,
|
||||
@@ -150,7 +150,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
router_builder.build()
|
||||
};
|
||||
|
||||
// Build RepoCode tools if configured
|
||||
// Build CodeTool tools if configured
|
||||
let app_code_tools = if !config.app_code.is_empty() {
|
||||
let mut apps = Vec::new();
|
||||
for app_config in config.app_code {
|
||||
@@ -163,7 +163,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(Arc::new(RepoCodeTools::new(apps)))
|
||||
Some(Arc::new(CodeToolTools::new(apps)))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user