Skip to content
Closed
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
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ version = "0.1.0"
rust-version = "1.94"
edition = "2024"

[workspace.lints.clippy]
# #[async_trait] generates methods returning Pin<Box<dyn Future>> with an
# implicit #[must_use]; newer clippy nightlies flag this as double_must_use.
double_must_use = "allow"

[profile.release]
lto = true
codegen-units = 1
Expand Down
3 changes: 3 additions & 0 deletions crates/forge_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ forge_config.workspace = true
tokio = { workspace = true }



[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ insta.workspace = true
tokio-stream.workspace = true
fake = { version = "5.1.0", features = ["derive"] }
forge_domain = { path = "../forge_domain" }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ derive_setters.workspace = true

[dev-dependencies]


[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ is_ci.workspace = true
pretty_assertions.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_display/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ two-face = "0.5.1"
insta.workspace = true
pretty_assertions.workspace = true
strip-ansi-escapes.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_domain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ insta = { workspace = true, features = ["yaml"] }
pretty_assertions.workspace = true
is_ci.workspace = true
fake = { version = "5.1.0", features = ["derive"] }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_embed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ rust-version.workspace = true
include_dir.workspace = true
handlebars.workspace = true
anyhow.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_eventsource/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
futures-retry = "0.6"
pin-utils = "0.1"
rocket = "0.5.0"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_eventsource_stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ http = "1.0"
reqwest = { version = "0.11", features = ["stream"] }
tokio = { version = "1.0", features = ["macros", "rt"] }
url = "2.2"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ forge_domain.workspace = true
[dev-dependencies]
tempfile = "3.27.0"
pretty_assertions = "1.4.0"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_infra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ serial_test = "4.0"
fake = { version = "5.1.0", features = ["derive"] }
pretty_assertions.workspace = true
forge_domain = { path = "../forge_domain" }

[lints]
workspace = true
4 changes: 3 additions & 1 deletion crates/forge_json_repair/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ schemars = { workspace = true }
serde_json5 = "0.2.1"

[dev-dependencies]
pretty_assertions = { workspace = true }
pretty_assertions = { workspace = true }
[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ pretty_assertions.workspace = true
serial_test = "4.0"
fake = { version = "5.1.0", features = ["derive"] }
forge_domain = { path = "../forge_domain" }

[lints]
workspace = true
2 changes: 0 additions & 2 deletions crates/forge_main/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use forge_api::Environment;
use crate::editor::{ForgeEditor, ReadResult};
use crate::model::{AppCommand, ForgeCommandManager};
use crate::prompt::ForgePrompt;
use crate::tracker;

/// Console implementation for handling user input via command line.
pub struct Console {
Expand Down Expand Up @@ -38,7 +37,6 @@ impl Console {
ReadResult::Exit => return Ok(AppCommand::Exit),
ReadResult::Empty => continue,
ReadResult::Success(text) => {
tracker::prompt(text.clone());
return self.command.parse(&text);
}
}
Expand Down
30 changes: 3 additions & 27 deletions crates/forge_main/src/tracker.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use forge_tracker::{EventKind, ToolCallPayload};
use forge_tracker::EventKind;

use crate::TRACKER;

/// Helper functions to eliminate duplication of tokio::spawn + TRACKER patterns
/// Generic dispatcher for any event
fn dispatch(event: EventKind) {
tokio::spawn(TRACKER.dispatch(event));
}

/// Dispatches an event blockingly
/// This is useful for events that are not expected to be dispatched in the
/// background
Expand All @@ -18,30 +12,12 @@ fn dispatch_blocking(event: EventKind) {
.ok();
}

/// For error events with Debug formatting
pub fn error<E: std::fmt::Debug>(error: E) {
dispatch(EventKind::Error(format!("{error:?}")));
}

/// For error events with Debug formatting (used by the panic hook, where the
/// tracing pipeline may no longer be available)
pub fn error_blocking<E: std::fmt::Debug>(error: E) {
dispatch_blocking(EventKind::Error(format!("{error:?}")));
}

/// For error events with string input
pub fn error_string(error: String) {
dispatch(EventKind::Error(error));
}

/// For tool call events
pub fn tool_call(payload: ToolCallPayload) {
dispatch(EventKind::ToolCall(payload));
}

/// For prompt events
pub fn prompt(text: String) {
dispatch(EventKind::Prompt(text));
}

/// For model setting
pub fn set_model(model: String) {
tokio::spawn(TRACKER.set_model(model));
Expand Down
22 changes: 1 addition & 21 deletions crates/forge_main/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use forge_domain::{
use forge_fs::ForgeFS;
use forge_select::{ForgeWidget, SelectRow};
use forge_spinner::SpinnerManager;
use forge_tracker::ToolCallPayload;
use forge_walker::Walker;
use futures::future;
use strum::IntoEnumIterator;
Expand Down Expand Up @@ -376,7 +375,6 @@ impl<A: API + ConsoleWriter + 'static, F: Fn(ForgeConfig) -> A + Send + Sync> UI
// Handle direct prompt or piped input if provided (raw text messages)
let input = self.cli.prompt.clone().or(self.cli.piped_input.clone());
if let Some(input) = input {
tracker::prompt(input.clone());
self.spinner.start(None)?;
tokio::select! {
_ = tokio::signal::ctrl_c() => {
Expand Down Expand Up @@ -408,11 +406,6 @@ impl<A: API + ConsoleWriter + 'static, F: Fn(ForgeConfig) -> A + Send + Sync> UI
match result {
Ok(exit) => if exit {return Ok(())},
Err(error) => {
if let Some(conversation_id) = self.state.conversation_id.as_ref()
&& let Some(conversation) = self.api.conversation(conversation_id).await.ok().flatten() {
TRACKER.set_conversation(conversation).await;
}
tracker::error(&error);
tracing::error!(error = ?error);
self.spinner.stop(None)?;
self.writeln_to_stderr(TitleFormat::error(format!("{error:?}")).display().to_string())?;
Expand All @@ -424,7 +417,6 @@ impl<A: API + ConsoleWriter + 'static, F: Fn(ForgeConfig) -> A + Send + Sync> UI
self.spinner.stop(None)?;
}
Err(error) => {
tracker::error(&error);
tracing::error!(error = ?error);
self.spinner.stop(None)?;

Expand Down Expand Up @@ -4167,19 +4159,7 @@ impl<A: API + ConsoleWriter + 'static, F: Fn(ForgeConfig) -> A + Send + Sync> UI
// stdout from appearing before the tool name is printed.
drop(_guard);
}
ChatResponse::ToolCallEnd(toolcall_result) => {
// Only track toolcall name in case of success else track the error.
let payload = if toolcall_result.is_error() {
let mut r = ToolCallPayload::new(toolcall_result.name.to_string());
if let Some(cause) = toolcall_result.output.as_str() {
r = r.with_cause(cause.to_string());
}
r
} else {
ToolCallPayload::new(toolcall_result.name.to_string())
};
tracker::tool_call(payload);

ChatResponse::ToolCallEnd(_toolcall_result) => {
self.spinner.start(None)?;
if !self.cli.verbose {
return Ok(());
Expand Down
3 changes: 3 additions & 0 deletions crates/forge_markdown_stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ terminal-colorsaurus = "1.0.3"
insta.workspace = true
strip-ansi-escapes.workspace = true
pretty_assertions.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_repo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ fake = { version = "5.1.0", features = ["derive"] }
derive_setters.workspace = true
mockito = { workspace = true }
regex = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_select/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ tracing.workspace = true

[dev-dependencies]
pretty_assertions.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_services/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ fake = { version = "5.1.0", features = ["derive"] }
forge_test_kit.workspace = true



[lints]
workspace = true
4 changes: 3 additions & 1 deletion crates/forge_snaps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ forge_domain.workspace = true

[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt", "time", "test-util"] }
tempfile.workspace = true
tempfile.workspace = true
[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_spinner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ rand = "0.10.0"
[dev-dependencies]
pretty_assertions.workspace = true
tokio = { workspace = true, features = ["test-util"] }

[lints]
workspace = true
4 changes: 3 additions & 1 deletion crates/forge_stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ futures.workspace = true
tokio.workspace = true

[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt", "time", "test-util"] }
tokio = { workspace = true, features = ["macros", "rt", "time", "test-util"] }
[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ html-escape = "0.2.13"

[dev-dependencies]
pretty_assertions.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_test_kit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ json = ["serde", "serde_json"]

[lib]
doctest = false

[lints]
workspace = true
4 changes: 3 additions & 1 deletion crates/forge_tool_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ proc-macro = true
[dependencies]
syn.workspace = true
quote.workspace = true
proc-macro2.workspace = true
proc-macro2.workspace = true
[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/forge_tracker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ uuid.workspace = true
tokio = { workspace = true, features = ["macros", "rt", "time", "test-util"] }
lazy_static.workspace = true
pretty_assertions.workspace = true

[lints]
workspace = true
Loading
Loading