diff --git a/src/copilotsetup/tabs/plugins.py b/src/copilotsetup/tabs/plugins.py index 1fcb564..ca20228 100644 --- a/src/copilotsetup/tabs/plugins.py +++ b/src/copilotsetup/tabs/plugins.py @@ -184,7 +184,10 @@ def detail_for(self, item: PluginInfo) -> str: parts.append(f" [dim]Latest release on origin:[/dim] {item.latest_release}") path = item.install_path or "" tag = item.latest_release or "" - parts.append(f" [dim]To pin to a release: cd {path}; git checkout {tag}; copilot plugin install .[/dim]") + reinstall = f"{item.name}@{item.marketplace}" if item.marketplace else "@" + parts.append( + f" [dim]To pin to a release: cd {path}; git checkout {tag}; copilot plugin install {reinstall}[/dim]" + ) if item.reason: parts.append(f"[bold]Reason:[/] {item.reason}") if item.install_path: @@ -273,7 +276,8 @@ def handle_upgrade(self) -> None: self.notify( f"{item.name}: local dev install on branch [bold]{branch}[/]. " f"To pin to a release, run in the source repo: " - f"[bold]git checkout {target}; copilot plugin install .[/]", + f"[bold]git checkout {target}; copilot plugin install " + f"{item.name}@{item.marketplace if item.marketplace else ''}[/]", severity="warning", title="Upgrade", timeout=12, diff --git a/tests/test_plugin_upgrades.py b/tests/test_plugin_upgrades.py index f4f87ec..93e9111 100644 --- a/tests/test_plugin_upgrades.py +++ b/tests/test_plugin_upgrades.py @@ -439,6 +439,7 @@ def test_git_env_preserves_existing_ssh_command(monkeypatch): def test_git_env_uses_gh_token_env(monkeypatch): """_git_env() injects GH_TOKEN via GIT_CONFIG_COUNT when set.""" + monkeypatch.delenv("GIT_CONFIG_COUNT", raising=False) monkeypatch.setenv("GH_TOKEN", "ghp_test123") from copilotsetup.plugin_upgrades import _git_env @@ -449,6 +450,7 @@ def test_git_env_uses_gh_token_env(monkeypatch): def test_git_env_uses_github_token_env(monkeypatch): """_git_env() falls back to GITHUB_TOKEN if GH_TOKEN not set.""" + monkeypatch.delenv("GIT_CONFIG_COUNT", raising=False) monkeypatch.delenv("GH_TOKEN", raising=False) monkeypatch.setenv("GITHUB_TOKEN", "ghs_fallback456") from copilotsetup.plugin_upgrades import _git_env @@ -460,6 +462,9 @@ def test_git_env_uses_github_token_env(monkeypatch): def test_git_env_no_token_no_gh(monkeypatch): """_git_env() gracefully handles no token and no gh CLI.""" + monkeypatch.delenv("GIT_CONFIG_COUNT", raising=False) + monkeypatch.delenv("GIT_CONFIG_KEY_0", raising=False) + monkeypatch.delenv("GIT_CONFIG_VALUE_0", raising=False) monkeypatch.delenv("GH_TOKEN", raising=False) monkeypatch.delenv("GITHUB_TOKEN", raising=False) with patch("copilotsetup.plugin_upgrades.subprocess.run", side_effect=FileNotFoundError): diff --git a/tests/test_plugins_tab.py b/tests/test_plugins_tab.py index dd8d34c..fcb432d 100644 --- a/tests/test_plugins_tab.py +++ b/tests/test_plugins_tab.py @@ -315,6 +315,7 @@ def test_handle_upgrade_short_circuits_for_dev_install(self): dev_summary="dev: feat/gh-writer", dev_branch="feat/gh-writer", latest_release="v2.0.2", + marketplace="github", ) tab = MagicMock(spec=PluginsTab) @@ -337,6 +338,8 @@ def test_handle_upgrade_short_circuits_for_dev_install(self): assert "feat/gh-writer" in msg assert "git checkout v2.0.2" in msg assert "copilot plugin install" in msg + assert "copilot plugin install ." not in msg # bare dot is invalid + assert "test-plugin@github" in msg # should use name@marketplace form def test_handle_upgrade_normal_path_unchanged(self): """Non-dev plugins with upgrade_available still call the CLI."""