Skip to content

Commit 0cb4eac

Browse files
committed
Fix hook status stable integration
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7be0dd64-982d-481d-ac57-4d6a59215727
1 parent c771762 commit 0cb4eac

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

tools/wta/src/agent_hooks_installer.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,19 +1473,17 @@ fn copilot_status(on_path: bool, bin_path: Option<String>, home: Option<&Path>)
14731473
);
14741474

14751475
// 1. plugin list (text — Copilot 1.0.44-2 has no --json).
1476-
let plugin_ok = join_or_run_plugin_cli(plugin_handle, "copilot", &["plugin", "list"])
1476+
let plugin_presence = join_or_run_plugin_cli(plugin_handle, "copilot", &["plugin", "list"])
14771477
.filter(|o| o.success)
14781478
.map(|o| parse_copilot_plugin_list(&o.stdout));
14791479
// 2. marketplace list (text).
14801480
let mkt_ok = join_or_run_plugin_cli(mkt_handle, "copilot", &["plugin", "marketplace", "list"])
14811481
.filter(|o| o.success)
14821482
.map(|o| parse_copilot_marketplace_list(&o.stdout));
14831483

1484-
if let (Some(p), Some(m)) = (plugin_ok, mkt_ok) {
1485-
out.plugin_installed = p;
1486-
// Copilot's `plugin list` doesn't expose enabled/disabled, so
1487-
// "listed" implies enabled. Disabling a plugin removes it.
1488-
out.plugin_enabled = p;
1484+
if let (Some(p), Some(m)) = (plugin_presence, mkt_ok) {
1485+
out.plugin_installed = p.installed;
1486+
out.plugin_enabled = p.enabled;
14891487
out.marketplace_registered = m;
14901488
} else {
14911489
copilot_fs_fallback(&mut out, home);

tools/wta/src/agent_hooks_installer_tests.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,20 @@ Installed plugins:
17861786
• superpowers@superpowers-marketplace (v5.1.0)
17871787
• wt-agent-hooks@wt-local (v0.1.0)
17881788
";
1789-
assert!(parse_copilot_plugin_list(stdout));
1789+
let presence = parse_copilot_plugin_list(stdout);
1790+
assert!(presence.installed);
1791+
assert!(presence.enabled);
1792+
}
1793+
1794+
#[test]
1795+
fn copilot_plugin_list_parser_detects_disabled_entry() {
1796+
let stdout = "\
1797+
Installed plugins:
1798+
• wt-agent-hooks@wt-local (v0.1.4) [disabled]
1799+
";
1800+
let presence = parse_copilot_plugin_list(stdout);
1801+
assert!(presence.installed);
1802+
assert!(!presence.enabled);
17901803
}
17911804

17921805
#[test]
@@ -1795,12 +1808,16 @@ fn copilot_plugin_list_parser_returns_false_when_missing() {
17951808
Installed plugins:
17961809
• superpowers@superpowers-marketplace (v5.1.0)
17971810
";
1798-
assert!(!parse_copilot_plugin_list(stdout));
1811+
let presence = parse_copilot_plugin_list(stdout);
1812+
assert!(!presence.installed);
1813+
assert!(!presence.enabled);
17991814
}
18001815

18011816
#[test]
18021817
fn copilot_plugin_list_parser_returns_false_when_empty() {
1803-
assert!(!parse_copilot_plugin_list(""));
1818+
let presence = parse_copilot_plugin_list("");
1819+
assert!(!presence.installed);
1820+
assert!(!presence.enabled);
18041821
}
18051822

18061823
/// Real `copilot plugin marketplace list` output. Built-in

0 commit comments

Comments
 (0)