Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from block:main #9

Merged
merged 5 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/goose-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod agent_version;
pub mod configure;
pub mod mcp;
pub mod session;
187 changes: 0 additions & 187 deletions crates/goose-cli/src/commands/session.rs

This file was deleted.

15 changes: 15 additions & 0 deletions crates/goose-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use etcetera::AppStrategyArgs;
use once_cell::sync::Lazy;
pub mod commands;
pub mod log_usage;
pub mod logging;
pub mod session;

// Re-export commonly used types
pub use session::Session;

pub static APP_STRATEGY: Lazy<AppStrategyArgs> = Lazy::new(|| AppStrategyArgs {
top_level_domain: "Block".to_string(),
author: "Block".to_string(),
app_name: "goose".to_string(),
});
15 changes: 10 additions & 5 deletions crates/goose-cli/src/log_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,21 @@ mod tests {
use etcetera::{choose_app_strategy, AppStrategy};
use goose::providers::base::{ProviderUsage, Usage};

use crate::{
log_usage::{log_usage, SessionLog},
test_helpers::run_with_tmp_dir,
};
use crate::log_usage::{log_usage, SessionLog};

pub fn run_with_tmp_dir<F: FnOnce() -> T, T>(func: F) -> T {
use tempfile::tempdir;

let temp_dir = tempdir().unwrap();
let temp_dir_path = temp_dir.path().to_path_buf();

temp_env::with_vars([("HOME", Some(temp_dir_path.as_os_str()))], func)
}

#[test]
fn test_session_logging() {
run_with_tmp_dir(|| {
let home_dir = choose_app_strategy(crate::APP_STRATEGY.clone()).unwrap();

let log_file = home_dir
.in_state_dir("logs")
.unwrap_or_else(|| home_dir.in_data_dir("logs"))
Expand Down
29 changes: 6 additions & 23 deletions crates/goose-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
use anyhow::Result;
use clap::{CommandFactory, Parser, Subcommand};
use etcetera::AppStrategyArgs;
use once_cell::sync::Lazy;

pub static APP_STRATEGY: Lazy<AppStrategyArgs> = Lazy::new(|| AppStrategyArgs {
top_level_domain: "Block".to_string(),
author: "Block".to_string(),
app_name: "goose".to_string(),
});

mod commands;
mod log_usage;
mod logging;
mod prompt;
mod session;

use commands::agent_version::AgentCommand;
use commands::configure::handle_configure;
use commands::mcp::run_server;
use commands::session::build_session;

use console::style;
use goose::config::Config;
use logging::setup_logging;
use goose_cli::commands::agent_version::AgentCommand;
use goose_cli::commands::configure::handle_configure;
use goose_cli::commands::mcp::run_server;
use goose_cli::logging::setup_logging;
use goose_cli::session::build_session;
use std::io::{self, Read};

#[cfg(test)]
mod test_helpers;

#[derive(Parser)]
#[command(author, version, display_name = "", about, long_about = None)]
struct Cli {
Expand Down
39 changes: 0 additions & 39 deletions crates/goose-cli/src/prompt.rs

This file was deleted.

Loading
Loading