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
8 changes: 6 additions & 2 deletions src/copilotsetup/tabs/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<path>"
tag = item.latest_release or "<tag>"
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 "<name>@<marketplace>"
Comment thread
ericchansen marked this conversation as resolved.
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:
Expand Down Expand Up @@ -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 '<marketplace>'}[/]",
Comment thread
ericchansen marked this conversation as resolved.
severity="warning",
title="Upgrade",
timeout=12,
Expand Down
5 changes: 5 additions & 0 deletions tests/test_plugin_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_plugins_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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."""
Expand Down
Loading