From ae128e2823af1ded441963185483766af4438127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Thu, 28 May 2026 23:32:52 -0600 Subject: [PATCH 1/3] Add Kiro shell plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eddú Meléndez --- plugins/kiro/api_key.go | 39 ++++++++++++++++++++++++++++++++ plugins/kiro/api_key_test.go | 43 ++++++++++++++++++++++++++++++++++++ plugins/kiro/kiro.go | 22 ++++++++++++++++++ plugins/kiro/plugin.go | 22 ++++++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 plugins/kiro/api_key.go create mode 100644 plugins/kiro/api_key_test.go create mode 100644 plugins/kiro/kiro.go create mode 100644 plugins/kiro/plugin.go diff --git a/plugins/kiro/api_key.go b/plugins/kiro/api_key.go new file mode 100644 index 00000000..6083e6ae --- /dev/null +++ b/plugins/kiro/api_key.go @@ -0,0 +1,39 @@ +package kiro + +import ( + "github.com/1Password/shell-plugins/sdk" + "github.com/1Password/shell-plugins/sdk/importer" + "github.com/1Password/shell-plugins/sdk/provision" + "github.com/1Password/shell-plugins/sdk/schema" + "github.com/1Password/shell-plugins/sdk/schema/credname" + "github.com/1Password/shell-plugins/sdk/schema/fieldname" +) + +func APIKey() schema.CredentialType { + return schema.CredentialType{ + Name: credname.APIKey, + DocsURL: sdk.URL("https://kiro.dev/docs/cli/authentication/"), + ManagementURL: sdk.URL("https://app.kiro.dev"), + Fields: []schema.CredentialField{ + { + Name: fieldname.APIKey, + MarkdownDescription: "API Key used to authenticate to Kiro.", + Secret: true, + Composition: &schema.ValueComposition{ + Prefix: "ksk_", + Charset: schema.Charset{ + Uppercase: true, + Lowercase: true, + Digits: true, + }, + }, + }, + }, + DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), + Importer: importer.TryEnvVarPair(defaultEnvVarMapping), + } +} + +var defaultEnvVarMapping = map[string]sdk.FieldName{ + "KIRO_API_KEY": fieldname.APIKey, +} diff --git a/plugins/kiro/api_key_test.go b/plugins/kiro/api_key_test.go new file mode 100644 index 00000000..c08e8de4 --- /dev/null +++ b/plugins/kiro/api_key_test.go @@ -0,0 +1,43 @@ +package kiro + +import ( + "testing" + + "github.com/1Password/shell-plugins/sdk" + "github.com/1Password/shell-plugins/sdk/plugintest" + "github.com/1Password/shell-plugins/sdk/schema/fieldname" +) + +const exampleAPIKey = "ksk_12345678" + +func TestAPIKeyProvisioner(t *testing.T) { + plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ + "default": { + ItemFields: map[sdk.FieldName]string{ + fieldname.APIKey: exampleAPIKey, + }, + ExpectedOutput: sdk.ProvisionOutput{ + Environment: map[string]string{ + "KIRO_API_KEY": exampleAPIKey, + }, + }, + }, + }) +} + +func TestAPIKeyImporter(t *testing.T) { + plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{ + "environment": { + Environment: map[string]string{ + "KIRO_API_KEY": exampleAPIKey, + }, + ExpectedCandidates: []sdk.ImportCandidate{ + { + Fields: map[sdk.FieldName]string{ + fieldname.APIKey: exampleAPIKey, + }, + }, + }, + }, + }) +} diff --git a/plugins/kiro/kiro.go b/plugins/kiro/kiro.go new file mode 100644 index 00000000..938a8134 --- /dev/null +++ b/plugins/kiro/kiro.go @@ -0,0 +1,22 @@ +package kiro + +import ( + "github.com/1Password/shell-plugins/sdk" + "github.com/1Password/shell-plugins/sdk/needsauth" + "github.com/1Password/shell-plugins/sdk/schema" + "github.com/1Password/shell-plugins/sdk/schema/credname" +) + +func KiroCLI() schema.Executable { + return schema.Executable{ + Name: "Kiro CLI", + Runs: []string{"kiro-cli"}, + DocsURL: sdk.URL("https://kiro.dev/docs/cli/"), + NeedsAuth: needsauth.NotForHelpOrVersion(), + Uses: []schema.CredentialUsage{ + { + Name: credname.APIKey, + }, + }, + } +} diff --git a/plugins/kiro/plugin.go b/plugins/kiro/plugin.go new file mode 100644 index 00000000..8d0fa90d --- /dev/null +++ b/plugins/kiro/plugin.go @@ -0,0 +1,22 @@ +package kiro + +import ( + "github.com/1Password/shell-plugins/sdk" + "github.com/1Password/shell-plugins/sdk/schema" +) + +func New() schema.Plugin { + return schema.Plugin{ + Name: "kiro", + Platform: schema.PlatformInfo{ + Name: "Kiro", + Homepage: sdk.URL("https://kiro.dev"), + }, + Credentials: []schema.CredentialType{ + APIKey(), + }, + Executables: []schema.Executable{ + KiroCLI(), + }, + } +} From 1e8effb115cb193e90f759271852512a130c933a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Wed, 17 Jun 2026 12:21:03 -0600 Subject: [PATCH 2/3] Fix comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eddú Meléndez --- plugins/kiro/kiro.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/kiro/kiro.go b/plugins/kiro/kiro.go index 938a8134..538925b7 100644 --- a/plugins/kiro/kiro.go +++ b/plugins/kiro/kiro.go @@ -12,7 +12,12 @@ func KiroCLI() schema.Executable { Name: "Kiro CLI", Runs: []string{"kiro-cli"}, DocsURL: sdk.URL("https://kiro.dev/docs/cli/"), - NeedsAuth: needsauth.NotForHelpOrVersion(), + NeedsAuth: needsauth.IfAll( + needsauth.NotForHelpOrVersion(), + needsauth.NotWithoutArgs(), + needsauth.NotWhenContainsArgs("login"), + needsauth.NotWhenContainsArgs("logout"), + ), Uses: []schema.CredentialUsage{ { Name: credname.APIKey, From 3c8fff11cc0ab5c24e9c06d92bce748de16f6154 Mon Sep 17 00:00:00 2001 From: Scott Lougheed Date: Wed, 17 Jun 2026 12:17:18 -0700 Subject: [PATCH 3/3] fixing linting issue --- plugins/kiro/kiro.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/kiro/kiro.go b/plugins/kiro/kiro.go index 538925b7..9e458cd8 100644 --- a/plugins/kiro/kiro.go +++ b/plugins/kiro/kiro.go @@ -9,9 +9,9 @@ import ( func KiroCLI() schema.Executable { return schema.Executable{ - Name: "Kiro CLI", - Runs: []string{"kiro-cli"}, - DocsURL: sdk.URL("https://kiro.dev/docs/cli/"), + Name: "Kiro CLI", + Runs: []string{"kiro-cli"}, + DocsURL: sdk.URL("https://kiro.dev/docs/cli/"), NeedsAuth: needsauth.IfAll( needsauth.NotForHelpOrVersion(), needsauth.NotWithoutArgs(),