From 892e5dd7af40d6a3d95585774b047a1052dddd89 Mon Sep 17 00:00:00 2001 From: prenoob <43581965+PreNoob@users.noreply.github.com> Date: Tue, 24 Nov 2026 23:59:24 +0100 Subject: [PATCH] Fix auth injection for interactive Copilot CLI Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- plugins/copilot/copilot.go | 1 - plugins/copilot/copilot_test.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 plugins/copilot/copilot_test.go diff --git a/plugins/copilot/copilot.go b/plugins/copilot/copilot.go index b8ef73320..51b236285 100644 --- a/plugins/copilot/copilot.go +++ b/plugins/copilot/copilot.go @@ -14,7 +14,6 @@ func CopilotCLI() schema.Executable { DocsURL: sdk.URL("https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference"), NeedsAuth: needsauth.IfAll( needsauth.NotForHelpOrVersion(), - needsauth.NotWithoutArgs(), needsauth.NotForExactArgs("login"), needsauth.NotForExactArgs("version"), needsauth.NotWhenContainsArgs("completion"), diff --git a/plugins/copilot/copilot_test.go b/plugins/copilot/copilot_test.go new file mode 100644 index 000000000..35defd727 --- /dev/null +++ b/plugins/copilot/copilot_test.go @@ -0,0 +1,32 @@ +package copilot + +import ( + "testing" + + "github.com/1Password/shell-plugins/sdk/plugintest" +) + +func TestCopilotCLINeedsAuth(t *testing.T) { + plugintest.TestNeedsAuth(t, CopilotCLI().NeedsAuth, map[string]plugintest.NeedsAuthCase{ + "interactive session": { + Args: []string{}, + ExpectedNeedsAuth: true, + }, + "agent invocation": { + Args: []string{"--agent", "blub"}, + ExpectedNeedsAuth: true, + }, + "login": { + Args: []string{"login"}, + ExpectedNeedsAuth: false, + }, + "version": { + Args: []string{"version"}, + ExpectedNeedsAuth: false, + }, + "completion": { + Args: []string{"completion", "bash"}, + ExpectedNeedsAuth: false, + }, + }) +}