rename app-code crate to repo-code
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
use conf::Conf;
|
||||
use metrics_exporter_prometheus::PrometheusBuilder;
|
||||
use signal_gateway::{CommandRouter, Gateway, GatewayConfig, Handling};
|
||||
use signal_gateway_app_code::AppCodeTools;
|
||||
use signal_gateway_assistant_claude::{ClaudeAssistant, ClaudeConfig};
|
||||
use signal_gateway_repo_code::RepoCodeTools;
|
||||
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 app_code;
|
||||
use app_code::AppCodeConfigExt;
|
||||
mod repo_code;
|
||||
use repo_code::RepoCodeConfigExt;
|
||||
|
||||
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<AppCodeConfigExt>,
|
||||
app_code: Vec<RepoCodeConfigExt>,
|
||||
/// 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 AppCode tools if configured
|
||||
// Build RepoCode 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(AppCodeTools::new(apps)))
|
||||
Some(Arc::new(RepoCodeTools::new(apps)))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
//! Extended configuration for application source code browsing.
|
||||
|
||||
use serde::Deserialize;
|
||||
use signal_gateway_app_code::{AppCode, AppCodeConfig, ShaCallback};
|
||||
use signal_gateway_repo_code::{RepoCode, RepoCodeConfig, ShaCallback};
|
||||
use std::sync::Arc;
|
||||
use tracing::warn;
|
||||
use url::Url;
|
||||
|
||||
/// Extended configuration for AppCode with HTTP-based SHA fetching.
|
||||
/// Extended configuration for RepoCode with HTTP-based SHA fetching.
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct AppCodeConfigExt {
|
||||
/// The base AppCode configuration.
|
||||
pub struct RepoCodeConfigExt {
|
||||
/// The base RepoCode configuration.
|
||||
#[serde(flatten)]
|
||||
pub config: AppCodeConfig,
|
||||
pub config: RepoCodeConfig,
|
||||
/// URL to GET the current deployed version SHA.
|
||||
pub version_sha_http_get: Url,
|
||||
}
|
||||
|
||||
impl AppCodeConfigExt {
|
||||
/// Convert to an AppCode instance with HTTP-based SHA callback.
|
||||
pub fn into_app_code(self) -> Result<AppCode, std::io::Error> {
|
||||
impl RepoCodeConfigExt {
|
||||
/// Convert to an RepoCode instance with HTTP-based SHA callback.
|
||||
pub fn into_app_code(self) -> Result<RepoCode, std::io::Error> {
|
||||
let url = self.version_sha_http_get.clone();
|
||||
let client = reqwest::Client::new();
|
||||
|
||||
@@ -66,6 +66,6 @@ impl AppCodeConfigExt {
|
||||
})
|
||||
});
|
||||
|
||||
AppCode::new(self.config, sha_callback)
|
||||
RepoCode::new(self.config, sha_callback)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user