Skip to content

Commit

Permalink
feat: sync local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
codestory committed Jan 29, 2025
1 parent 3d6566a commit 5fd4de8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
6 changes: 3 additions & 3 deletions reproduce_error.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import subprocess
import sys
import subprocess

def main():
# Try to list available tools in zed
# Try to list available tools in sidecar
try:
result = subprocess.run(['cargo', 'run', '--bin', 'sidecar', '--', 'tools', 'list'],
result = subprocess.run(['cargo', 'run', '--bin', 'webserver', '--', 'tools', 'list'],
cwd='sidecar',
capture_output=True,
text=True)
Expand Down
14 changes: 11 additions & 3 deletions sidecar/src/application/config/configuration.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
use std::path::{Path, PathBuf};

use clap::Parser;
use clap::{Parser, Subcommand};
use serde::{Deserialize, Serialize};

use crate::repo::state::StateSource;

#[derive(Subcommand, Debug, Clone, Serialize, Deserialize)]
pub enum Tools {
/// List all available tools
List,
}

#[derive(Serialize, Deserialize, Parser, Debug, Clone, Default)]
#[clap(author, version, about, long_about = None)]
pub struct Configuration {
#[clap(subcommand)]
pub tools: Option<Tools>,

#[clap(short, long, default_value_os_t = default_index_dir())]
#[serde(default = "default_index_dir")]
/// Directory to store all persistent state
Expand Down Expand Up @@ -111,4 +119,4 @@ fn default_collection_name() -> String {
fn default_user_id() -> String {
let username = whoami::username();
username
}
}
20 changes: 18 additions & 2 deletions sidecar/src/bin/webserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use axum::extract::DefaultBodyLimit;
use axum::routing::get;
use axum::Extension;
use clap::Parser;
use sidecar::application::{application::Application, config::configuration::Configuration};
use sidecar::application::{application::Application, config::configuration::{Configuration, Tools}};
use std::net::SocketAddr;
use tokio::signal;
use tokio::sync::oneshot;
Expand All @@ -26,6 +26,22 @@ async fn main() -> Result<()> {
info!("CodeStory 🚀");
let configuration = Configuration::parse();

// Handle tools subcommand
if let Some(tools_cmd) = configuration.tools {
match tools_cmd {
Tools::List => {
println!("Available tools:");
println!(" - list_files: List files in a directory");
println!(" - search_files: Search for patterns in files");
println!(" - read_file: Read content from a file");
println!(" - code_edit: Edit or create files");
println!(" - execute_command: Run shell commands");
println!(" - repo_map: Generate repository map");
return Ok(());
}
}
}

// We get the logging setup first
debug!("installing logging to local file");
Application::install_logging(&configuration);
Expand Down Expand Up @@ -278,4 +294,4 @@ fn tree_sitter_router() -> Router {
fn file_operations_router() -> Router {
use axum::routing::*;
Router::new().route("/edit_file", post(sidecar::webserver::file_edit::file_edit))
}
}

0 comments on commit 5fd4de8

Please sign in to comment.