Skip to content
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
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ lite = []
medium = ["lang-dart", "lang-pascal", "lang-php", "lang-ruby", "lang-bash", "lang-protobuf", "lang-powershell", "lang-nix", "lang-vbnet"]
full = ["medium", "lang-lua", "lang-zig", "lang-objc", "lang-perl", "lang-batch", "lang-fortran", "lang-cobol", "lang-msbasic2", "lang-gwbasic", "lang-qbasic", "lang-dockerfile", "lang-glsl", "lang-wgsl", "lang-hlsl", "lang-metal", "lang-markdown", "lang-r", "lang-sql", "lang-julia", "lang-haskell", "lang-ocaml", "lang-clojure", "lang-erlang", "lang-elixir", "lang-fsharp", "lang-quint", "lang-toml", "lang-lean"]

# Language features (all grammars provided by tokensave-large-treesitters)
# Language features backed by the bundled tree-sitter grammar crate.
lang-dart = []
lang-pascal = []
lang-php = []
Expand Down Expand Up @@ -106,7 +106,7 @@ axum = "0.8"
libsql = "0.9.30"
tree-sitter = "0.26"
tree-sitter-language = "0.1"
tokensave-large-treesitters = { version = "0.5.0", git = "https://github.com/aovestdipaperino/tokensave-large-treesitters" }
tracedecay-large-treesitters = { package = "tokensave-large-treesitters", version = "0.5.0", git = "https://github.com/aovestdipaperino/tokensave-large-treesitters" }
clap = { version = "4.6", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down Expand Up @@ -154,4 +154,3 @@ criterion = { version = "0.5", features = ["async_tokio", "html_reports"] }
[[bench]]
name = "large_repos"
harness = false

6 changes: 6 additions & 0 deletions cursor-plugin/hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
"timeout": 5
}
],
"preCompact": [
{
"command": "tracedecay hook-cursor-pre-compact",
"timeout": 120
}
],
"beforeSubmitPrompt": [
{
"command": "tracedecay hook-cursor-before-submit-prompt",
Expand Down
48 changes: 19 additions & 29 deletions src/accounting/classifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,30 @@ impl fmt::Display for TaskCategory {
}

impl TaskCategory {
pub fn as_str(&self) -> &'static str {
fn strings(self) -> (&'static str, &'static str) {
match self {
Self::Coding => "coding",
Self::Debugging => "debugging",
Self::FeatureDev => "feature_dev",
Self::Refactoring => "refactoring",
Self::Testing => "testing",
Self::Exploration => "exploration",
Self::Planning => "planning",
Self::Delegation => "delegation",
Self::GitOps => "git_ops",
Self::BuildDeploy => "build_deploy",
Self::Brainstorming => "brainstorming",
Self::Conversation => "conversation",
Self::General => "general",
Self::Coding => ("coding", "Coding"),
Self::Debugging => ("debugging", "Debugging"),
Self::FeatureDev => ("feature_dev", "Feature Dev"),
Self::Refactoring => ("refactoring", "Refactoring"),
Self::Testing => ("testing", "Testing"),
Self::Exploration => ("exploration", "Exploration"),
Self::Planning => ("planning", "Planning"),
Self::Delegation => ("delegation", "Delegation"),
Self::GitOps => ("git_ops", "Git Ops"),
Self::BuildDeploy => ("build_deploy", "Build/Deploy"),
Self::Brainstorming => ("brainstorming", "Brainstorming"),
Self::Conversation => ("conversation", "Conversation"),
Self::General => ("general", "General"),
}
}

pub fn as_str(&self) -> &'static str {
(*self).strings().0
}

pub fn label(&self) -> &'static str {
match self {
Self::Coding => "Coding",
Self::Debugging => "Debugging",
Self::FeatureDev => "Feature Dev",
Self::Refactoring => "Refactoring",
Self::Testing => "Testing",
Self::Exploration => "Exploration",
Self::Planning => "Planning",
Self::Delegation => "Delegation",
Self::GitOps => "Git Ops",
Self::BuildDeploy => "Build/Deploy",
Self::Brainstorming => "Brainstorming",
Self::Conversation => "Conversation",
Self::General => "General",
}
(*self).strings().1
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/accounting/pricing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Pricing lifecycle:
//! 1. **Cached file** at `pricing.json` in the user data dir
//! (`~/.tracedecay/`, or legacy `~/.tokensave/`) -- checked first.
//! (`~/.tracedecay/`) -- checked first.
//! 2. **Embedded fallback** baked into the binary -- used when no cache exists.
//! 3. **Remote refresh** from `LiteLLM`'s public pricing JSON -- fetched at most
//! once every 24 hours, stored to the cache file.
Expand Down Expand Up @@ -51,8 +51,7 @@ pub struct ModelPricing {
pub cache_read_per_mtok: f64,
}

/// Path to the cached pricing file: `pricing.json` in the user data dir
/// (`~/.tracedecay/`, or legacy `~/.tokensave/`).
/// Path to the cached pricing file: `pricing.json` in the user data dir.
fn cache_path() -> Option<PathBuf> {
crate::config::user_data_dir().map(|dir| dir.join("pricing.json"))
}
Expand Down
21 changes: 6 additions & 15 deletions src/agents/antigravity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ fn cli_plugin_path(home: &Path) -> std::path::PathBuf {
home.join(".gemini/antigravity-cli/plugins/tracedecay.json")
}

fn legacy_cli_plugin_path(home: &Path) -> std::path::PathBuf {
home.join(".gemini/antigravity-cli/plugins/tokensave.json")
}

impl AgentIntegration for AntigravityIntegration {
fn name(&self) -> &'static str {
"Antigravity"
Expand Down Expand Up @@ -109,7 +105,6 @@ impl AgentIntegration for AntigravityIntegration {
let mcp_path = mcp_config_path(&ctx.home);
uninstall_mcp_server(&mcp_path);
uninstall_cli_plugin(&cli_plugin_path(&ctx.home));
uninstall_cli_plugin(&legacy_cli_plugin_path(&ctx.home));

eprintln!();
eprintln!("Uninstall complete. Tracedecay has been removed from Antigravity.");
Expand Down Expand Up @@ -137,23 +132,20 @@ impl AgentIntegration for AntigravityIntegration {
if mcp_path.exists() {
let servers = load_json_file(&mcp_path).get("mcpServers").cloned();
servers.as_ref().and_then(|v| v.get("tracedecay")).is_some()
|| servers.as_ref().and_then(|v| v.get("tokensave")).is_some()
} else {
false
}
};
let cli_ok = {
let plugin_path = cli_plugin_path(home);
let legacy_path = legacy_cli_plugin_path(home);
let has_entry = |path: &std::path::Path| {
if !path.exists() {
return false;
}
let servers = load_json_file(path).get("mcpServers").cloned();
servers.as_ref().and_then(|v| v.get("tracedecay")).is_some()
|| servers.as_ref().and_then(|v| v.get("tokensave")).is_some()
};
has_entry(&plugin_path) || has_entry(&legacy_path)
has_entry(&plugin_path)
};
ide_ok || cli_ok
}
Expand Down Expand Up @@ -181,17 +173,16 @@ fn uninstall_mcp_server(mcp_path: &Path) {
.and_then(|v| v.as_object_mut())
else {
eprintln!(
" No tracedecay/tokensave MCP server in {}, skipping",
" No tracedecay MCP server in {}, skipping",
mcp_path.display()
);
return;
};

let removed_new = servers.remove("tracedecay").is_some();
let removed_legacy = servers.remove("tokensave").is_some();
if !removed_new && !removed_legacy {
let removed = servers.remove("tracedecay").is_some();
if !removed {
eprintln!(
" No tracedecay/tokensave MCP server in {}, skipping",
" No tracedecay MCP server in {}, skipping",
mcp_path.display()
);
return;
Expand All @@ -212,7 +203,7 @@ fn uninstall_mcp_server(mcp_path: &Path) {
let pretty = serde_json::to_string_pretty(&settings).unwrap_or_default();
std::fs::write(mcp_path, format!("{pretty}\n")).ok();
eprintln!(
"\x1b[32m✔\x1b[0m Removed tracedecay/tokensave MCP server from {}",
"\x1b[32m✔\x1b[0m Removed tracedecay MCP server from {}",
mcp_path.display()
);
}
Expand Down
Loading
Loading