Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(trace): categorize az and tea forge CLIs as network (#3689)

Worktrunk Bot89c52c5acca2
diff --git a/src/trace/chrome.rs b/src/trace/chrome.rs
index c50acbf40..3c613c74b 100644
--- a/src/trace/chrome.rs
+++ b/src/trace/chrome.rs
@@ -95,10 +95,15 @@ pub fn to_chrome_trace(entries: &[TraceEntry]) -> String {
TraceEntryKind::Command {
command, duration, ..
} => {
- // Categorize by program type
+ // Categorize by program type. The forge CLIs worktrunk
+ // shells out to — `gh`/`glab` and also `az` (Azure DevOps)
+ // and `tea` (Gitea) — group under `network`.
let cat = if command.starts_with("git ") {
Some("git".to_string())
- } else if command.starts_with("gh ") || command.starts_with("glab ") {
+ } else if ["gh ", "glab ", "az ", "tea "]
+ .iter()
+ .any(|prefix| command.starts_with(prefix))
+ {
Some("network".to_string())
} else {
None
@@ -276,7 +281,9 @@ mod tests {
make_command_entry("git status", 10, Some(0), Some(1)),
make_command_entry("gh pr list", 100, Some(0), Some(2)),
make_command_entry("glab mr list", 100, Some(0), Some(3)),
- make_command_entry("echo hello", 1, Some(0), Some(4)),
+ make_command_entry("az repos pr show", 100, Some(0), Some(4)),
+ make_command_entry("tea api /repos/x/y", 100, Some(0), Some(5)),
+ make_command_entry("echo hello", 1, Some(0), Some(6)),
];
let json = to_chrome_trace(&entries);
@@ -284,9 +291,12 @@ mod tests {
let events = parsed["traceEvents"].as_array().unwrap();
assert_eq!(events[0]["cat"], "git");
+ // All forge CLIs (gh, glab, az, tea) group under `network`.
assert_eq!(events[1]["cat"], "network");
assert_eq!(events[2]["cat"], "network");
- assert!(events[3]["cat"].is_null()); // No category for other commands
+ assert_eq!(events[3]["cat"], "network");
+ assert_eq!(events[4]["cat"], "network");
+ assert!(events[5]["cat"].is_null()); // No category for other commands
}
#[test]