refactor: remove owlen-code binary and code-client feature

Remove the separate owlen-code binary as code assistance functionality
is now integrated into the main application through the mode consolidation system.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-09 20:31:46 +02:00
parent e57844e742
commit 4c066bf2da
2 changed files with 0 additions and 149 deletions

View File

@@ -11,18 +11,12 @@ description = "Command-line interface for OWLEN LLM client"
[features] [features]
default = ["chat-client"] default = ["chat-client"]
chat-client = ["owlen-tui"] chat-client = ["owlen-tui"]
code-client = []
[[bin]] [[bin]]
name = "owlen" name = "owlen"
path = "src/main.rs" path = "src/main.rs"
required-features = ["chat-client"] required-features = ["chat-client"]
[[bin]]
name = "owlen-code"
path = "src/code_main.rs"
required-features = ["code-client"]
[[bin]] [[bin]]
name = "owlen-agent" name = "owlen-agent"
path = "src/agent_main.rs" path = "src/agent_main.rs"

View File

@@ -1,143 +0,0 @@
//! OWLEN Code Mode - TUI client optimized for coding assistance
use anyhow::Result;
use clap::{Arg, Command};
use owlen_core::{session::SessionController, storage::StorageManager};
use owlen_ollama::OllamaProvider;
use owlen_tui::{config, ui, AppState, CodeApp, Event, EventHandler, SessionEvent};
use std::io;
use std::sync::Arc;
use tokio::sync::mpsc;
use tokio_util::sync::CancellationToken;
use crossterm::{
event::{DisableMouseCapture, EnableMouseCapture},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use ratatui::{backend::CrosstermBackend, Terminal};
#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<()> {
let matches = Command::new("owlen-code")
.about("OWLEN Code Mode - TUI optimized for programming assistance")
.version(env!("CARGO_PKG_VERSION"))
.arg(
Arg::new("model")
.short('m')
.long("model")
.value_name("MODEL")
.help("Preferred model to use for this session"),
)
.get_matches();
let mut config = config::try_load_config().unwrap_or_default();
// Disable encryption for code mode.
config.privacy.encrypt_local_data = false;
if let Some(model) = matches.get_one::<String>("model") {
config.general.default_model = Some(model.clone());
}
let provider_name = config.general.default_provider.clone();
let provider_cfg = config::ensure_provider_config(&mut config, &provider_name).clone();
let provider_type = provider_cfg.provider_type.to_ascii_lowercase();
if provider_type != "ollama" && provider_type != "ollama-cloud" {
anyhow::bail!(
"Unsupported provider type '{}' configured for provider '{}'",
provider_cfg.provider_type,
provider_name
);
}
let provider = Arc::new(OllamaProvider::from_config(
&provider_cfg,
Some(&config.general),
)?);
let storage = Arc::new(StorageManager::new().await?);
// Code client - code execution tools enabled
use owlen_core::ui::NoOpUiController;
let controller = SessionController::new(
provider,
config.clone(),
storage.clone(),
Arc::new(NoOpUiController),
true,
)
.await?;
let (mut app, mut session_rx) = CodeApp::new(controller).await?;
app.inner_mut().initialize_models().await?;
let cancellation_token = CancellationToken::new();
let (event_tx, event_rx) = mpsc::unbounded_channel();
let event_handler = EventHandler::new(event_tx, cancellation_token.clone());
let event_handle = tokio::spawn(async move { event_handler.run().await });
enable_raw_mode()?;
let mut stdout = io::stdout();
execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
let backend = CrosstermBackend::new(stdout);
let mut terminal = Terminal::new(backend)?;
let result = run_app(&mut terminal, &mut app, event_rx, &mut session_rx).await;
cancellation_token.cancel();
event_handle.await?;
config::save_config(&app.inner().config())?;
disable_raw_mode()?;
execute!(
terminal.backend_mut(),
LeaveAlternateScreen,
DisableMouseCapture
)?;
terminal.show_cursor()?;
if let Err(err) = result {
println!("{err:?}");
}
Ok(())
}
async fn run_app(
terminal: &mut Terminal<CrosstermBackend<io::Stdout>>,
app: &mut CodeApp,
mut event_rx: mpsc::UnboundedReceiver<Event>,
session_rx: &mut mpsc::UnboundedReceiver<SessionEvent>,
) -> Result<()> {
loop {
// Advance loading animation frame
app.inner_mut().advance_loading_animation();
terminal.draw(|f| ui::render_chat(f, app.inner_mut()))?;
// Process any pending LLM requests AFTER UI has been drawn
if let Err(e) = app.inner_mut().process_pending_llm_request().await {
eprintln!("Error processing LLM request: {}", e);
}
// Process any pending tool executions AFTER UI has been drawn
if let Err(e) = app.inner_mut().process_pending_tool_execution().await {
eprintln!("Error processing tool execution: {}", e);
}
tokio::select! {
Some(event) = event_rx.recv() => {
if let AppState::Quit = app.handle_event(event).await? {
return Ok(());
}
}
Some(session_event) = session_rx.recv() => {
app.handle_session_event(session_event)?;
}
// Add a timeout to keep the animation going even when there are no events
_ = tokio::time::sleep(tokio::time::Duration::from_millis(100)) => {
// This will cause the loop to continue and advance the animation
}
}
}
}