From 164fa79aad792e2642760feff80a840a79d963c3 Mon Sep 17 00:00:00 2001 From: Zachary Miller Date: Thu, 27 Nov 2025 13:23:58 -0500 Subject: [PATCH] Add Doppler CLI shell plugin Authenticate the Doppler CLI using Touch ID and other unlock options with 1Password Shell Plugins. The plugin supports: - Personal Access Token authentication - Environment variable import from DOPPLER_TOKEN - Automatic provisioning as DOPPLER_TOKEN - CLI authentication detection Signed-off-by: Zachary Miller --- plugins/doppler/doppler.go | 25 +++++ plugins/doppler/plugin.go | 22 +++++ plugins/doppler/service_token.go | 42 ++++++++ plugins/doppler/service_token_test.go | 46 +++++++++ plugins/plugins.go | 133 ++++++++++++++++++++++++++ 5 files changed, 268 insertions(+) create mode 100644 plugins/doppler/doppler.go create mode 100644 plugins/doppler/plugin.go create mode 100644 plugins/doppler/service_token.go create mode 100644 plugins/doppler/service_token_test.go create mode 100644 plugins/plugins.go diff --git a/plugins/doppler/doppler.go b/plugins/doppler/doppler.go new file mode 100644 index 00000000..556f863f --- /dev/null +++ b/plugins/doppler/doppler.go @@ -0,0 +1,25 @@ +package doppler + +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 DopplerCLI() schema.Executable { + return schema.Executable{ + Name: "Doppler CLI", + Runs: []string{"doppler"}, + DocsURL: sdk.URL("https://docs.doppler.com/docs/cli"), + NeedsAuth: needsauth.IfAll( + needsauth.NotForHelpOrVersion(), + needsauth.NotWithoutArgs(), + ), + Uses: []schema.CredentialUsage{ + { + Name: credname.PersonalAccessToken, + }, + }, + } +} diff --git a/plugins/doppler/plugin.go b/plugins/doppler/plugin.go new file mode 100644 index 00000000..0e6135e5 --- /dev/null +++ b/plugins/doppler/plugin.go @@ -0,0 +1,22 @@ +package doppler + +import ( + "github.com/1Password/shell-plugins/sdk" + "github.com/1Password/shell-plugins/sdk/schema" +) + +func New() schema.Plugin { + return schema.Plugin{ + Name: "doppler", + Platform: schema.PlatformInfo{ + Name: "Doppler", + Homepage: sdk.URL("https://doppler.com"), + }, + Credentials: []schema.CredentialType{ + ServiceToken(), + }, + Executables: []schema.Executable{ + DopplerCLI(), + }, + } +} diff --git a/plugins/doppler/service_token.go b/plugins/doppler/service_token.go new file mode 100644 index 00000000..0d178e45 --- /dev/null +++ b/plugins/doppler/service_token.go @@ -0,0 +1,42 @@ +package doppler + +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 ServiceToken() schema.CredentialType { + return schema.CredentialType{ + Name: credname.PersonalAccessToken, + DocsURL: sdk.URL("https://docs.doppler.com/docs/cli"), + ManagementURL: sdk.URL("https://dashboard.doppler.com/workplace//tokens/personal"), + Fields: []schema.CredentialField{ + { + Name: fieldname.Token, + MarkdownDescription: "Personal Token used to authenticate to Doppler.", + Secret: true, + Composition: &schema.ValueComposition{ + Prefix: "dp.pt.", + Charset: schema.Charset{ + Uppercase: true, + Lowercase: true, + Digits: true, + }, + }, + }, + }, + DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), + Importer: importer.TryAll( + importer.TryEnvVarPair(defaultEnvVarMapping), + importer.TryAllEnvVars(fieldname.Token, "DOPPLER_TOKEN"), + ), + } +} + +var defaultEnvVarMapping = map[string]sdk.FieldName{ + "DOPPLER_TOKEN": fieldname.Token, +} diff --git a/plugins/doppler/service_token_test.go b/plugins/doppler/service_token_test.go new file mode 100644 index 00000000..11af0aae --- /dev/null +++ b/plugins/doppler/service_token_test.go @@ -0,0 +1,46 @@ +package doppler + +import ( + "testing" + + "github.com/1Password/shell-plugins/sdk" + "github.com/1Password/shell-plugins/sdk/plugintest" + "github.com/1Password/shell-plugins/sdk/schema/fieldname" +) + +func TestServiceTokenImporter(t *testing.T) { + plugintest.TestImporter(t, ServiceToken().Importer, map[string]plugintest.ImportCase{ + "DOPPLER_TOKEN environment variable": { + Environment: map[string]string{ + "DOPPLER_TOKEN": "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE", + }, + ExpectedCandidates: []sdk.ImportCandidate{ + { + Fields: map[sdk.FieldName]string{ + fieldname.Token: "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE", + }, + }, + { + Fields: map[sdk.FieldName]string{ + fieldname.Token: "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE", + }, + }, + }, + }, + }) +} + +func TestServiceTokenProvisioner(t *testing.T) { + plugintest.TestProvisioner(t, ServiceToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ + "default": { + ItemFields: map[sdk.FieldName]string{ + fieldname.Token: "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE", + }, + ExpectedOutput: sdk.ProvisionOutput{ + Environment: map[string]string{ + "DOPPLER_TOKEN": "dp.pt.SQgRDoLc2lBYVu5Vr2T4XHPvBcp0HlhMZq8F11whbvQEXAMPLE", + }, + }, + }, + }) +} diff --git a/plugins/plugins.go b/plugins/plugins.go new file mode 100644 index 00000000..457f1dfa --- /dev/null +++ b/plugins/plugins.go @@ -0,0 +1,133 @@ +package plugins + +// This file gets auto-generated by the "make registry" command, so should not be edited by hand. + +import ( + "github.com/1Password/shell-plugins/plugins/akamai" + "github.com/1Password/shell-plugins/plugins/argocd" + "github.com/1Password/shell-plugins/plugins/atlas" + "github.com/1Password/shell-plugins/plugins/aws" + "github.com/1Password/shell-plugins/plugins/axiom" + "github.com/1Password/shell-plugins/plugins/binance" + "github.com/1Password/shell-plugins/plugins/cachix" + "github.com/1Password/shell-plugins/plugins/cargo" + "github.com/1Password/shell-plugins/plugins/circleci" + "github.com/1Password/shell-plugins/plugins/civo" + "github.com/1Password/shell-plugins/plugins/confluent" + "github.com/1Password/shell-plugins/plugins/crowdin" + "github.com/1Password/shell-plugins/plugins/databricks" + "github.com/1Password/shell-plugins/plugins/datadog" + "github.com/1Password/shell-plugins/plugins/digitalocean" + "github.com/1Password/shell-plugins/plugins/doppler" + "github.com/1Password/shell-plugins/plugins/fastly" + "github.com/1Password/shell-plugins/plugins/flyctl" + "github.com/1Password/shell-plugins/plugins/fossa" + "github.com/1Password/shell-plugins/plugins/gitea" + "github.com/1Password/shell-plugins/plugins/github" + "github.com/1Password/shell-plugins/plugins/gitlab" + "github.com/1Password/shell-plugins/plugins/hcloud" + "github.com/1Password/shell-plugins/plugins/heroku" + "github.com/1Password/shell-plugins/plugins/homebrew" + "github.com/1Password/shell-plugins/plugins/huggingface" + "github.com/1Password/shell-plugins/plugins/influxdb" + "github.com/1Password/shell-plugins/plugins/kaggle" + "github.com/1Password/shell-plugins/plugins/lacework" + "github.com/1Password/shell-plugins/plugins/laravelforge" + "github.com/1Password/shell-plugins/plugins/laravelvapor" + "github.com/1Password/shell-plugins/plugins/linode" + "github.com/1Password/shell-plugins/plugins/localstack" + "github.com/1Password/shell-plugins/plugins/mysql" + "github.com/1Password/shell-plugins/plugins/ngrok" + "github.com/1Password/shell-plugins/plugins/ohdear" + "github.com/1Password/shell-plugins/plugins/okta" + "github.com/1Password/shell-plugins/plugins/openai" + "github.com/1Password/shell-plugins/plugins/pipedream" + "github.com/1Password/shell-plugins/plugins/postgresql" + "github.com/1Password/shell-plugins/plugins/pulumi" + "github.com/1Password/shell-plugins/plugins/readme" + "github.com/1Password/shell-plugins/plugins/scaleway" + "github.com/1Password/shell-plugins/plugins/sentry" + "github.com/1Password/shell-plugins/plugins/snowflake" + "github.com/1Password/shell-plugins/plugins/snyk" + "github.com/1Password/shell-plugins/plugins/sourcegraph" + "github.com/1Password/shell-plugins/plugins/stripe" + "github.com/1Password/shell-plugins/plugins/terraform" + "github.com/1Password/shell-plugins/plugins/todoist" + "github.com/1Password/shell-plugins/plugins/treasuredata" + "github.com/1Password/shell-plugins/plugins/tugboat" + "github.com/1Password/shell-plugins/plugins/twilio" + "github.com/1Password/shell-plugins/plugins/upstash" + "github.com/1Password/shell-plugins/plugins/vault" + "github.com/1Password/shell-plugins/plugins/vercel" + "github.com/1Password/shell-plugins/plugins/vertica" + "github.com/1Password/shell-plugins/plugins/vultr" + "github.com/1Password/shell-plugins/plugins/wrangler" + "github.com/1Password/shell-plugins/plugins/yugabytedb" + "github.com/1Password/shell-plugins/plugins/zapier" + "github.com/1Password/shell-plugins/plugins/zendesk" +) + +func init() { + Register(akamai.New()) + Register(argocd.New()) + Register(atlas.New()) + Register(aws.New()) + Register(axiom.New()) + Register(binance.New()) + Register(cachix.New()) + Register(cargo.New()) + Register(circleci.New()) + Register(civo.New()) + Register(confluent.New()) + Register(crowdin.New()) + Register(databricks.New()) + Register(datadog.New()) + Register(digitalocean.New()) + Register(doppler.New()) + Register(fastly.New()) + Register(flyctl.New()) + Register(fossa.New()) + Register(gitea.New()) + Register(github.New()) + Register(gitlab.New()) + Register(hcloud.New()) + Register(heroku.New()) + Register(homebrew.New()) + Register(huggingface.New()) + Register(influxdb.New()) + Register(kaggle.New()) + Register(lacework.New()) + Register(laravelforge.New()) + Register(laravelvapor.New()) + Register(linode.New()) + Register(localstack.New()) + Register(mysql.New()) + Register(ngrok.New()) + Register(ohdear.New()) + Register(okta.New()) + Register(openai.New()) + Register(pipedream.New()) + Register(postgresql.New()) + Register(pulumi.New()) + Register(readme.New()) + Register(scaleway.New()) + Register(sentry.New()) + Register(snowflake.New()) + Register(snyk.New()) + Register(sourcegraph.New()) + Register(stripe.New()) + Register(terraform.New()) + Register(todoist.New()) + Register(treasuredata.New()) + Register(tugboat.New()) + Register(twilio.New()) + Register(upstash.New()) + Register(vault.New()) + Register(vercel.New()) + Register(vertica.New()) + Register(vultr.New()) + Register(wrangler.New()) + Register(yugabytedb.New()) + Register(zapier.New()) + Register(zendesk.New()) +}