├── plugins ├── aws │ ├── test-fixtures │ │ ├── empty-config │ │ ├── config │ │ ├── custom-config │ │ └── credentials │ ├── utils.go │ ├── plugin.go │ ├── aws.go │ ├── eksctl.go │ ├── awslogs.go │ ├── cdk.go │ ├── cache_utils.go │ └── sam.go ├── huggingface │ ├── test-fixtures │ │ └── token │ ├── plugin.go │ ├── huggingface-cli.go │ └── user_access_token_test.go ├── todoist │ ├── test-fixtures │ │ └── config.json │ ├── plugin.go │ ├── todoist.go │ └── api_token_test.go ├── vercel │ ├── test-fixtures │ │ └── auth.json │ ├── plugin.go │ ├── vercel.go │ └── api_token_test.go ├── vultr │ ├── test-fixtures │ │ └── vultr-cli.yaml │ ├── plugin.go │ └── vultr-cli.go ├── snyk │ ├── test-fixtures │ │ └── snyk.json │ ├── plugin.go │ ├── snyk.go │ └── api_token_test.go ├── zapier │ ├── test-fixtures │ │ └── .zapierrc │ ├── plugin.go │ ├── zapier.go │ └── deploy_key_test.go ├── kaggle │ ├── test-fixtures │ │ └── config.json │ ├── plugin.go │ ├── kaggle.go │ └── api_token_test.go ├── pipedream │ ├── test-fixtures │ │ ├── provision │ │ └── import │ ├── plugin.go │ ├── pd.go │ └── api_key_test.go ├── flyctl │ ├── test-fixtures │ │ └── config.yml │ ├── plugin.go │ ├── fly.go │ ├── flyctl.go │ └── access_token_test.go ├── mysql │ ├── test-fixtures │ │ └── mysql.cnf │ ├── plugin.go │ └── mysql.go ├── okta │ ├── test-fixtures │ │ └── okta.yaml │ ├── plugin.go │ └── okta.go ├── snowflake │ ├── test-fixtures │ │ ├── config1 │ │ ├── config2 │ │ └── config3 │ ├── plugin.go │ └── snowsql.go ├── treasuredata │ ├── test-fixtures │ │ └── td.conf │ ├── plugin.go │ └── td.go ├── datadog │ ├── test-fixtures │ │ └── .dogrc │ ├── plugin.go │ └── dogshell.go ├── upstash │ ├── test-fixtures │ │ └── .upstash.json │ ├── plugin.go │ └── upstash.go ├── heroku │ ├── test-fixtures │ │ ├── netrc-non-heroku │ │ └── netrc │ ├── plugin.go │ └── heroku.go ├── civo │ ├── test-fixtures │ │ └── .civo.json │ ├── plugin.go │ ├── civo.go │ └── api_key_test.go ├── github │ ├── test-fixtures │ │ ├── hosts_gho_token.yml │ │ └── hosts.yml │ ├── plugin.go │ └── gh.go ├── ngrok │ ├── test-fixtures │ │ └── config.yml │ ├── plugin.go │ └── ngrok.go ├── hcloud │ ├── test-fixtures │ │ └── hcloud.toml │ ├── plugin.go │ ├── hcloud.go │ └── api_token_test.go ├── readme │ ├── test-fixtures │ │ └── readme.json │ ├── plugin.go │ ├── rdme_test.go │ └── rdme.go ├── sentry │ ├── test-fixtures │ │ └── .sentryclirc │ ├── plugin.go │ └── sentry_cli.go ├── digitalocean │ ├── test-fixtures │ │ └── config.yaml │ ├── plugin.go │ └── doctl.go ├── cargo │ ├── test-fixtures │ │ └── credentials.toml │ ├── plugin.go │ ├── cargo.go │ └── api_token_test.go ├── gitlab │ ├── test-fixtures │ │ ├── glab-config.yaml │ │ └── glab-config-self-hosted.yaml │ ├── plugin.go │ └── glab.go ├── linode │ ├── test-fixtures │ │ └── linode-cli │ ├── plugin.go │ └── linode-cli.go ├── akamai │ ├── test-fixtures │ │ ├── .edgerc-single │ │ └── .edgerc-multiple │ ├── plugin.go │ └── akamai.go ├── scaleway │ ├── test-fixtures │ │ └── config │ ├── plugin.go │ └── scw.go ├── cachix │ ├── test-fixtures │ │ └── cachix.dhall │ ├── plugin.go │ └── cachix.go ├── circleci │ ├── test-fixtures │ │ └── cli.yaml │ ├── plugin.go │ ├── circleci.go │ └── personal_api_token_test.go ├── gitea │ ├── test-fixtures │ │ ├── config.yml │ │ └── import_config.yml │ ├── plugin.go │ └── tea.go ├── lacework │ ├── test-fixtures │ │ └── lacework.toml │ ├── plugin.go │ └── lacework.go ├── fastly │ ├── test-fixtures │ │ └── config.toml │ ├── plugin.go │ └── fastly.go ├── terraform │ ├── plugin.go │ └── terraform.go ├── argocd │ ├── test-fixtures │ │ └── config │ ├── plugin.go │ └── argocd.go ├── fossa │ ├── plugin.go │ ├── fossa.go │ └── api_key.go ├── databricks │ ├── test-fixtures │ │ └── databrickscfg │ ├── plugin.go │ └── databricks.go ├── twilio │ ├── plugin.go │ ├── test-fixtures │ │ └── config.json │ └── twilio.go ├── axiom │ ├── plugin.go │ ├── axiom.go │ └── personal_access_token_test.go ├── binance │ ├── plugin.go │ ├── binance_cli.go │ ├── api_key_test.go │ └── api_key.go ├── ohdear │ ├── plugin.go │ ├── ohdear.go │ ├── api_token_test.go │ └── api_token.go ├── stripe │ ├── plugin.go │ ├── stripe.go │ └── test-fixtures │ │ └── config.toml ├── crowdin │ ├── plugin.go │ └── crowdin.go ├── atlas │ ├── plugin.go │ ├── atlas.go │ ├── apikey_test.go │ └── apikey.go ├── pulumi │ ├── plugin.go │ ├── pulumi.go │ └── test-fixtures │ │ └── credentials.json ├── tugboat │ ├── plugin.go │ └── tugboat.go ├── zendesk │ ├── plugin.go │ ├── zcli.go │ └── api_token_test.go ├── homebrew │ ├── plugin.go │ ├── brew.go │ └── personal_access_token.go ├── vault │ ├── plugin.go │ ├── vault.go │ ├── auth_token_test.go │ └── auth_token.go ├── localstack │ ├── plugin.go │ ├── localstack.go │ ├── api_key_test.go │ └── api_key.go ├── vertica │ ├── plugin.go │ ├── vsql.go │ └── database_credentials_test.go ├── confluent │ ├── plugin.go │ └── confluent.go ├── influxdb │ ├── plugin.go │ ├── influx.go │ ├── database_credentials_test.go │ └── database_credentials.go ├── sourcegraph │ ├── plugin.go │ ├── src.go │ ├── access_token_test.go │ └── access_token.go ├── yugabytedb │ ├── plugin.go │ ├── ysqlsh.go │ └── database_credentials_test.go ├── laravelforge │ ├── plugin.go │ ├── forge.go │ └── test-fixtures │ │ └── config.json ├── laravelvapor │ ├── plugin.go │ ├── vapor.go │ └── test-fixtures │ │ └── config.json ├── wrangler │ ├── plugin.go │ └── wrangler.go ├── openai │ ├── plugin.go │ ├── openai.go │ ├── codex.go │ ├── oaieval.go │ ├── oaievalset.go │ ├── api_key_test.go │ └── api_key.go ├── postgresql │ ├── plugin.go │ ├── pgcli.go │ ├── psql.go │ ├── pg_dump.go │ ├── pg_restore.go │ └── database_credentials_test.go └── registry_test.go ├── sdk ├── diagnostics.go ├── util.go ├── example │ ├── plugin_test.go │ ├── plugin.go │ └── example.go ├── importer │ ├── no_op.go │ ├── source.go │ ├── helpers.go │ └── env_var_importer.go ├── needs_auth.go ├── provision │ ├── no_op.go │ └── env_var_provisioner.go ├── plugintest │ ├── needs_auth_test_helper.go │ ├── test_fixture_helper.go │ └── validation_report_test.go ├── rpc │ └── server │ │ └── plugin.go └── names.go ├── nix ├── nixos.nix └── home-manager.nix ├── .gitignore ├── .github ├── workflows │ ├── pr-check-signed-commits.yml │ ├── check-flake.yml │ └── test.yaml └── ISSUE_TEMPLATE │ ├── config.yml │ ├── 2-issue-op-cli.yml │ ├── 3-issue-existing-plugin.yml │ ├── 4-issue-contributing.yml │ └── 1-new-plugin-request.yml ├── .golangci.yml ├── flake.nix ├── LICENSE ├── cmd └── contrib │ ├── build │ └── main.go │ └── scripts │ └── config_dir_getter.go ├── flake.lock └── Makefile /plugins/aws/test-fixtures/empty-config: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plugins/huggingface/test-fixtures/token: -------------------------------------------------------------------------------- 1 | hf_yVvZeburdKtnwkVCWPXimmNwaFuEXAMPLE 2 | -------------------------------------------------------------------------------- /plugins/todoist/test-fixtures/config.json: -------------------------------------------------------------------------------- 1 | {"token":"dbq9y65uguqrk4ognfhdiwcc0zx34z20pexample"} -------------------------------------------------------------------------------- /plugins/vercel/test-fixtures/auth.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "tZk79pLyPLGgUVlkHbnLeXgl" 3 | } 4 | -------------------------------------------------------------------------------- /plugins/vultr/test-fixtures/vultr-cli.yaml: -------------------------------------------------------------------------------- 1 | api-key: 4T7FVVVS23ZMKHLV990NL61F4O6L9EXAMPLE 2 | -------------------------------------------------------------------------------- /plugins/snyk/test-fixtures/snyk.json: -------------------------------------------------------------------------------- 1 | { 2 | "api": "38j9ss3m5m3c44vi916z6p33m21xgexample" 3 | } 4 | -------------------------------------------------------------------------------- /plugins/zapier/test-fixtures/.zapierrc: -------------------------------------------------------------------------------- 1 | { 2 | "deployKey": "g22y9yajfqqcogilnrnm5lxv6example" 3 | } -------------------------------------------------------------------------------- /plugins/kaggle/test-fixtures/config.json: -------------------------------------------------------------------------------- 1 | {"username":"username","key":"z2pifkruzgbb17plmz2gux21fexample"} -------------------------------------------------------------------------------- /plugins/pipedream/test-fixtures/provision: -------------------------------------------------------------------------------- 1 | api_key = ugvfxesz62ycsl42z49c0t1hjexample 2 | org_id = YbEXAMPLE 3 | -------------------------------------------------------------------------------- /plugins/flyctl/test-fixtures/config.yml: -------------------------------------------------------------------------------- 1 | access_token: DtP7HoOPOBHMP6bE5tx3nguB5r2zPpSbg9hlEXAMPLE 2 | wire_guard_state: {} 3 | -------------------------------------------------------------------------------- /plugins/mysql/test-fixtures/mysql.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | user=root 3 | password=123456 4 | host=localhost 5 | port=3306 6 | database=test 7 | -------------------------------------------------------------------------------- /plugins/okta/test-fixtures/okta.yaml: -------------------------------------------------------------------------------- 1 | okta: 2 | client: {orgUrl: 'https://acme.okta.com', token: dIzt9kbedfNLtBNvWaprp39MaffIVjWxkZBEXAMPLE} 3 | -------------------------------------------------------------------------------- /plugins/snowflake/test-fixtures/config1: -------------------------------------------------------------------------------- 1 | [connections] 2 | 3 | accountname = accountname 4 | username = username 5 | password = password1234 6 | -------------------------------------------------------------------------------- /plugins/treasuredata/test-fixtures/td.conf: -------------------------------------------------------------------------------- 1 | [account] 2 | user = user@example.com 3 | apikey = 1/this12is34an56exampleb13645b6apikey229fa48 4 | -------------------------------------------------------------------------------- /plugins/aws/test-fixtures/config: -------------------------------------------------------------------------------- 1 | [default] 2 | region = eu-central-1 3 | output = None 4 | 5 | [profile user1] 6 | region = us-east-1 7 | output = None -------------------------------------------------------------------------------- /plugins/datadog/test-fixtures/.dogrc: -------------------------------------------------------------------------------- 1 | [Connection] 2 | apikey = fbypf5r8ifaitop8l1v2eij5jexample 3 | appkey = 7czlyi5zub72zsheuctce49pfro8swdcnexample 4 | -------------------------------------------------------------------------------- /plugins/upstash/test-fixtures/.upstash.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiKey":"d68850db-69f7-qxe9pubcmjnqfgyexample", 3 | "email" : "wendy@appleseed.com" 4 | } 5 | -------------------------------------------------------------------------------- /plugins/aws/test-fixtures/custom-config: -------------------------------------------------------------------------------- 1 | [default] 2 | region = us-west-1 3 | output = None 4 | 5 | [profile user1] 6 | region = us-west-1 7 | output = None -------------------------------------------------------------------------------- /plugins/heroku/test-fixtures/netrc-non-heroku: -------------------------------------------------------------------------------- 1 | machine someotherwebsite 2 | login wendy@appleseed.com 3 | password dh7k7m662pqglxaybr1p0gpg1cu33example 4 | -------------------------------------------------------------------------------- /plugins/civo/test-fixtures/.civo.json: -------------------------------------------------------------------------------- 1 | { 2 | "apikeys": { 3 | "testdemoname": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /sdk/diagnostics.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | type Diagnostics struct { 4 | Errors []Error 5 | } 6 | 7 | type Error struct { 8 | Message string 9 | } 10 | -------------------------------------------------------------------------------- /nix/nixos.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, config, ... }: 2 | import ./shell-plugins.nix { 3 | inherit pkgs; 4 | inherit lib; 5 | inherit config; 6 | is-home-manager = false; 7 | } 8 | -------------------------------------------------------------------------------- /plugins/github/test-fixtures/hosts_gho_token.yml: -------------------------------------------------------------------------------- 1 | github.com: 2 | user: testUser2 3 | oauth_token: gho_8BQUJmcVkoNo7LqYY0Ng1wndPbwwfEXAMPLE 4 | git_protocol: https 5 | -------------------------------------------------------------------------------- /nix/home-manager.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, config, ... }: 2 | import ./shell-plugins.nix { 3 | inherit pkgs; 4 | inherit lib; 5 | inherit config; 6 | is-home-manager = true; 7 | } 8 | -------------------------------------------------------------------------------- /plugins/ngrok/test-fixtures/config.yml: -------------------------------------------------------------------------------- 1 | api_key: NQdxymVXmWC15916Mmy1vYkpzzNG6a84Bo4mYKuDahEXAMPLE 2 | authtoken: cxG2Im21Yzkh8VnvFQaetlPHcQ9ZDUUk1IzzyHhcGcEXAMPLE 3 | version: "2" 4 | -------------------------------------------------------------------------------- /plugins/hcloud/test-fixtures/hcloud.toml: -------------------------------------------------------------------------------- 1 | active_context = 'default' 2 | 3 | [[contexts]] 4 | name = 'default' 5 | token = 'dcAuOpQaCNvjzsNPmeGXvegHBdq4Zamx8QjI8ibxfErzy34fjL4ZOITFvdP5SKct' -------------------------------------------------------------------------------- /plugins/readme/test-fixtures/readme.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiKey": "rdme_9o50rxz28p0msun40apgyzvkdji2vhxyd7b8emioclkrx57ucpb5x2d31yu39taexample", 3 | "email": "owlbert@readme.io", 4 | "project": "test-subdomain" 5 | } 6 | -------------------------------------------------------------------------------- /plugins/sentry/test-fixtures/.sentryclirc: -------------------------------------------------------------------------------- 1 | [defaults] 2 | url = https://sentry.acme.com/ 3 | project = my-project 4 | org = acme 5 | 6 | [auth] 7 | token = mw4ms9tx4dci52bfr19sbj40lb0pu9w4camnf8w3hfzl8hckvkdocd28nexample 8 | -------------------------------------------------------------------------------- /sdk/util.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | func URL(urlStr string) *url.URL { 8 | parsed, err := url.Parse(urlStr) 9 | if err != nil { 10 | panic(err) 11 | } 12 | return parsed 13 | } 14 | -------------------------------------------------------------------------------- /plugins/digitalocean/test-fixtures/config.yaml: -------------------------------------------------------------------------------- 1 | access-token: dop_v1_tr33mpd5m8q9t3ncisqbceydi8dd2n60pl1yiycg97z25fkqffp8j6ycjexample 2 | config: ${HOME}/Library/Application Support/doctl/config.yaml 3 | context: default 4 | output: text 5 | -------------------------------------------------------------------------------- /plugins/cargo/test-fixtures/credentials.toml: -------------------------------------------------------------------------------- 1 | [registry] 2 | token = "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE" 3 | 4 | [registries.reg1] 5 | token = "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE2" 6 | 7 | [registries.reg2] 8 | token = "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE3" 9 | -------------------------------------------------------------------------------- /plugins/heroku/test-fixtures/netrc: -------------------------------------------------------------------------------- 1 | machine api.heroku.com 2 | login wendy@appleseed.com 3 | password dh7k7m662pqglxaybr1p0gpg1cu33example 4 | machine git.heroku.com 5 | login wendy@appleseed.com 6 | password dh7k7m662pqglxaybr1p0gpg1cu33example 7 | -------------------------------------------------------------------------------- /plugins/gitlab/test-fixtures/glab-config.yaml: -------------------------------------------------------------------------------- 1 | git_protocol: ssh 2 | check_update: false 3 | display_hyperlinks: false 4 | hosts: 5 | gitlab.com: 6 | api_protocol: https 7 | api_host: gitlab.com 8 | token: glpat-sJy3L26ZNW7A3EXAMPLE 9 | -------------------------------------------------------------------------------- /plugins/linode/test-fixtures/linode-cli: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | default-user = acme 3 | 4 | [acme] 5 | token = cn5z4umbimz0lxgzvps1bl979n8lpwnu6qmb4x19bddzx6siormnoxg2yexample 6 | 7 | [prod] 8 | token = 92bs7ljhixcnfwlwhcdxkp3d4z6p5qza17jiwwf61duwcend43nlz86rkexample 9 | -------------------------------------------------------------------------------- /plugins/pipedream/test-fixtures/import: -------------------------------------------------------------------------------- 1 | api_key = ugvfxesz62ycsl42z49c0t1hjexample 2 | org_id = YbEXAMPLE 3 | 4 | [first] 5 | api_key = 5puf32rvhkz83c6oj4wpxvaniexample 6 | org_id = KVEXAMPLE 7 | 8 | [second] 9 | api_key = lgx1amb0qf7mjy6y7nkgfc3x9example 10 | -------------------------------------------------------------------------------- /plugins/aws/test-fixtures/credentials: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id=AKIADEFFODNN7EXAMPLE 3 | aws_secret_access_key=DEFlrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 4 | 5 | [user1] 6 | aws_access_key_id=AKIAIOSFODNN7EXAMPLE 7 | aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 8 | -------------------------------------------------------------------------------- /plugins/gitlab/test-fixtures/glab-config-self-hosted.yaml: -------------------------------------------------------------------------------- 1 | git_protocol: ssh 2 | check_update: false 3 | display_hyperlinks: false 4 | hosts: 5 | gitlab.acme.com: 6 | api_protocol: https 7 | api_host: api.gitlab.acme.com 8 | token: glpat-sJy3L26ZNW7A3EXAMPLE 9 | -------------------------------------------------------------------------------- /plugins/snowflake/test-fixtures/config2: -------------------------------------------------------------------------------- 1 | [connections] 2 | 3 | accountname = accountname 4 | username = username 5 | password = password1234 6 | 7 | [connections.example] 8 | 9 | accountname = exampleaccountname 10 | username = exampleusername 11 | password = examplepassword1234 12 | -------------------------------------------------------------------------------- /plugins/snowflake/test-fixtures/config3: -------------------------------------------------------------------------------- 1 | [connections.example] 2 | 3 | accountname = exampleaccountname 4 | username = exampleusername 5 | password = examplepassword1234 6 | 7 | [connections] 8 | 9 | accountname = accountname 10 | username = username 11 | password = password1234 12 | -------------------------------------------------------------------------------- /plugins/akamai/test-fixtures/.edgerc-single: -------------------------------------------------------------------------------- 1 | [default] 2 | client_secret = abcdE23FNkBxy456z25qx9Yp5CPUxlEfQeTDkfh4QA=I 3 | host = akab-lmn789n2k53w7qrs-nfkxaa4lfk3kd6ym.luna.akamaiapis.net 4 | access_token = akab-zyx987xa6osbli4k-e7jf5ikib5jknes3 5 | client_token = akab-nomoflavjuc4422e-fa2xznerxrm3teg7 6 | -------------------------------------------------------------------------------- /plugins/scaleway/test-fixtures/config: -------------------------------------------------------------------------------- 1 | # comment 2 | access_key: yolo 3 | secret_key: c3a22663-2770-4428-8166-c214643cd70b 4 | default_organization_id: 14800390-5df1-4a90-b38e-9b461bdcd108 5 | default_project_id: 01696acf-7a78-4d94-a129-5e135d0377cc 6 | default_region: fr-par 7 | default_zone: fr-par-1 8 | -------------------------------------------------------------------------------- /sdk/example/plugin_test.go: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestPlugin(t *testing.T) { 10 | _, report := New().Validate() 11 | for _, c := range report.Checks { 12 | assert.True(t, c.Assertion) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plugins/cachix/test-fixtures/cachix.dhall: -------------------------------------------------------------------------------- 1 | { authToken = 2 | "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI3OGRlOTA4Yi03MjhiLTRiMjUtODA1Yi1hNTRjODIxMWQ1ZjMiLCJzY29wZXMiOiJ0eCJ9.A0XjByVJtp2Di0Ui7M5KjiG1OinYW8PwVKRw5N4YETE" 3 | , hostname = "https://cachix.org" 4 | , binaryCaches = [] : List { name : Text, secretKey : Text } 5 | } -------------------------------------------------------------------------------- /plugins/github/test-fixtures/hosts.yml: -------------------------------------------------------------------------------- 1 | github.com: 2 | user: testUser 3 | oauth_token: ghp_B2xokoZVNaqxLhWzxXY0MoARZyZlgEXAMPLE 4 | git_protocol: https 5 | 6 | enterprise.github.com: 7 | user: enterpriseUser 8 | oauth_token: ghp_4v7aWhddhdqyIR1RmqiRcUjTgzrNFEXAMPLE 9 | git_protocol: ssh 10 | -------------------------------------------------------------------------------- /plugins/circleci/test-fixtures/cli.yaml: -------------------------------------------------------------------------------- 1 | host: https://circleci.com 2 | endpoint: graphql-unstable 3 | token: 1evr6rbndnaphymaljwpulrlvws7oolrmexample 4 | rest_endpoint: api/v2 5 | tls_cert: "" 6 | tls_insecure: false 7 | orb_publishing: 8 | default_namespace: "" 9 | default_vcs_provider: "" 10 | default_owner: "" -------------------------------------------------------------------------------- /sdk/importer/no_op.go: -------------------------------------------------------------------------------- 1 | package importer 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | ) 8 | 9 | // NoOp can be used as an importer stub while developing plugins. 10 | func NoOp() sdk.Importer { 11 | return func(ctx context.Context, in sdk.ImportInput, out *sdk.ImportOutput) {} 12 | } 13 | -------------------------------------------------------------------------------- /sdk/needs_auth.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | // NeedsAuthentication provides a hook to check whether authentication are required for certain command args. 4 | type NeedsAuthentication func(in NeedsAuthenticationInput) (needsAuthentication bool) 5 | 6 | type NeedsAuthenticationInput struct { 7 | CredentialType string 8 | CommandArgs []string 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Auto-generated with `make registry` 2 | plugins/plugins.go 3 | 4 | # Auto-generated with `make registry.json` 5 | plugins/registry.json 6 | 7 | # GoLand 8 | .idea 9 | 10 | # VS code 11 | .vscode 12 | 13 | # Neovim project-specific configurations 14 | .nvimrc 15 | .exrc 16 | 17 | # MacOS finder 18 | .DS_Store 19 | 20 | # 1Password 21 | .op 22 | 23 | # direnv 24 | .direnv 25 | .envrc 26 | -------------------------------------------------------------------------------- /plugins/gitea/test-fixtures/config.yml: -------------------------------------------------------------------------------- 1 | logins: 2 | - name: https://git.example.com 3 | url: https://git.example.com 4 | token: oyyfsny27bgphldmhvffxhhlmqvdkzjrfslrsj9f 5 | default: true 6 | ssh_host: "" 7 | ssh_key: "" 8 | insecure: false 9 | ssh_certificate_principal: "" 10 | ssh_agent: false 11 | ssh_key_agent_pub: "" 12 | version_check: false 13 | user: example 14 | created: 0 15 | -------------------------------------------------------------------------------- /.github/workflows/pr-check-signed-commits.yml: -------------------------------------------------------------------------------- 1 | name: Check signed commits in PR 2 | on: pull_request_target 3 | 4 | jobs: 5 | build: 6 | name: Check signed commits in PR 7 | permissions: 8 | contents: read 9 | pull-requests: write 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check signed commits in PR 13 | uses: 1Password/check-signed-commits-action@main 14 | -------------------------------------------------------------------------------- /plugins/lacework/test-fixtures/lacework.toml: -------------------------------------------------------------------------------- 1 | [default] 2 | account = "example" 3 | api_key = "EXAMPLE_1234567890ABCDE1EXAMPLE1EXAMPLE123456789EXAMPLE" 4 | api_secret = "_89368245c62f8d6d35e7c6626example" 5 | version = 2 6 | 7 | [example] 8 | account = "example2" 9 | api_key = "EXAMPLE2_1234567890ABCDE1EXAMPLE1EXAMPLE123456789EXAMPLE" 10 | api_secret = "_69ee92b3c71a6b27436a648acexample" 11 | version = 2 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: "💬 Chat with us on Slack" 4 | url: https://developer.1password.com/joinslack 5 | about: Chat with us about shell plugins in our Developer Slack workspace. 6 | - name: "❓ General 1Password questions" 7 | url: https://1password.community 8 | about: I have a question about 1Password that's not directly related to shell plugins. 9 | -------------------------------------------------------------------------------- /plugins/fastly/test-fixtures/config.toml: -------------------------------------------------------------------------------- 1 | [profile] 2 | 3 | [profile.first] 4 | default = true 5 | email = "user@example.com" 6 | token = "4Oncq0V723ZO8HIqUgOTB77dsEXAMPLE" 7 | 8 | [profile.second] 9 | default = false 10 | email = "user-2@example.com" 11 | token = "NyK5NwkqXpuf74Le0omvFVUtZEXAMPLE" 12 | 13 | [profile.third] 14 | default = false 15 | email = "user-3@example.com" 16 | token = "L2IofeJGtvwy1fDSKNj5dEIRgEXAMPLE" 17 | -------------------------------------------------------------------------------- /plugins/terraform/plugin.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "terraform", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Terraform", 13 | Homepage: sdk.URL("https://www.terraform.io"), 14 | }, 15 | Executables: []schema.Executable{ 16 | TerraformCLI(), 17 | }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /plugins/argocd/test-fixtures/config: -------------------------------------------------------------------------------- 1 | contexts: 2 | - name: test-context 3 | server: argocd.test.domain 4 | user: test-user 5 | current-context: test-context 6 | servers: 7 | - server: argocd.test.domain 8 | users: 9 | - name: test-user 10 | auth-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJhZG1pbjphcGlLZXkiLCJuYmYiOjE2NzM3MjE0MDMsImlhdCI6MTY3MzcyMTQwMywianRpIjoiNTI5ODcwMTEtNGRiNy00ZmIxLWE4Y2MtMTk5NGViYTRjZDU0In0.ApWbS8sQbtp1l_ILaRO94izPv9AML2vnv1F3EXAMPLE 11 | -------------------------------------------------------------------------------- /plugins/snyk/plugin.go: -------------------------------------------------------------------------------- 1 | package snyk 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "snyk", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Snyk", 13 | Homepage: sdk.URL("https://snyk.io"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | SnykCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/aws/utils.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "fmt" 5 | 6 | "gopkg.in/ini.v1" 7 | ) 8 | 9 | func getConfigSectionByProfile(configFile *ini.File, profileName string) *ini.Section { 10 | for _, section := range configFile.Sections() { 11 | if profileName == "default" && section.Name() == "default" { 12 | return section 13 | } 14 | 15 | // handle profile sections 16 | if section.Name() == fmt.Sprintf("profile %s", profileName) { 17 | return section 18 | } 19 | } 20 | 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /plugins/cargo/plugin.go: -------------------------------------------------------------------------------- 1 | package cargo 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "cargo", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Cargo", 13 | Homepage: sdk.URL("https://crates.io"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | CargoCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/civo/plugin.go: -------------------------------------------------------------------------------- 1 | package civo 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "civo", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Civo", 13 | Homepage: sdk.URL("https://www.civo.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | CivoCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/fossa/plugin.go: -------------------------------------------------------------------------------- 1 | package fossa 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "fossa", 11 | Platform: schema.PlatformInfo{ 12 | Name: "FOSSA", 13 | Homepage: sdk.URL("https://fossa.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | FOSSACLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/okta/plugin.go: -------------------------------------------------------------------------------- 1 | package okta 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "okta", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Okta", 13 | Homepage: sdk.URL("https://www.okta.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | OktaCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/vultr/plugin.go: -------------------------------------------------------------------------------- 1 | package vultr 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "vultr", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Vultr", 13 | Homepage: sdk.URL("https://vultr.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | VultrCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/databricks/test-fixtures/databrickscfg: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | host = https://myinstance.azuredatabricks.net 3 | username = bob@company.com 4 | password = password123 5 | jobs-api-version = 2.1 6 | 7 | [secondprofile] 8 | host = https://myinstance.databricks.com 9 | token = dapif13ac4b49d1cb31f69f678e39602e381-2 10 | jobs-api-version = 2.0 11 | 12 | [thirdprofile] 13 | host = https://myinstance.databricks.com 14 | username = bob@company.com 15 | token = dapif13ac4b49d1cb31f69f678e39602e381-2 16 | jobs-api-version = 2.1 17 | 18 | -------------------------------------------------------------------------------- /plugins/heroku/plugin.go: -------------------------------------------------------------------------------- 1 | package heroku 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "heroku", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Heroku", 13 | Homepage: sdk.URL("https://heroku.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | HerokuCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/ngrok/plugin.go: -------------------------------------------------------------------------------- 1 | package ngrok 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "ngrok", 11 | Platform: schema.PlatformInfo{ 12 | Name: "ngrok", 13 | Homepage: sdk.URL("https://ngrok.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | Credentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ngrokCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/readme/plugin.go: -------------------------------------------------------------------------------- 1 | package readme 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "readme", 11 | Platform: schema.PlatformInfo{ 12 | Name: "ReadMe", 13 | Homepage: sdk.URL("https://readme.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ReadMeCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/twilio/plugin.go: -------------------------------------------------------------------------------- 1 | package twilio 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "twilio", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Twilio", 13 | Homepage: sdk.URL("https://twilio.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | TwilioCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/axiom/plugin.go: -------------------------------------------------------------------------------- 1 | package axiom 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "axiom", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Axiom", 13 | Homepage: sdk.URL("https://axiom.co"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | AxiomCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/binance/plugin.go: -------------------------------------------------------------------------------- 1 | package binance 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "binance", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Binance", 13 | Homepage: sdk.URL("https://binance.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | BinanceCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/datadog/plugin.go: -------------------------------------------------------------------------------- 1 | package datadog 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "datadog", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Datadog", 13 | Homepage: sdk.URL("https://datadoghq.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | Dogshell(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/fastly/plugin.go: -------------------------------------------------------------------------------- 1 | package fastly 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "fastly", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Fastly", 13 | Homepage: sdk.URL("https://fastly.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | FastlyCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/kaggle/plugin.go: -------------------------------------------------------------------------------- 1 | package kaggle 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "kaggle", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Kaggle", 13 | Homepage: sdk.URL("https://kaggle.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | KaggleCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/mysql/plugin.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "mysql", 11 | Platform: schema.PlatformInfo{ 12 | Name: "MySQL", 13 | Homepage: sdk.URL("https://mysql.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | DatabaseCredentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | Mysql(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/ohdear/plugin.go: -------------------------------------------------------------------------------- 1 | package ohdear 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "ohdear", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Oh Dear", 13 | Homepage: sdk.URL("https://ohdear.app"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | OhDearCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/sentry/plugin.go: -------------------------------------------------------------------------------- 1 | package sentry 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "sentry", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Sentry", 13 | Homepage: sdk.URL("https://sentry.io"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AuthToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | SentryCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/stripe/plugin.go: -------------------------------------------------------------------------------- 1 | package stripe 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "stripe", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Stripe", 13 | Homepage: sdk.URL("https://stripe.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | SecretKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | StripeCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/upstash/plugin.go: -------------------------------------------------------------------------------- 1 | package upstash 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "upstash", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Upstash", 13 | Homepage: sdk.URL("https://upstash.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | UpstashCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/vercel/plugin.go: -------------------------------------------------------------------------------- 1 | package vercel 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "vercel", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Vercel", 13 | Homepage: sdk.URL("https://vercel.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | VercelCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/zapier/plugin.go: -------------------------------------------------------------------------------- 1 | package zapier 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "zapier", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Zapier", 13 | Homepage: sdk.URL("https://zapier.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | DeployKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ZapierCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sdk/example/plugin.go: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "example", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Example", 13 | Homepage: sdk.URL("https://example.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ExampleCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/cachix/plugin.go: -------------------------------------------------------------------------------- 1 | package cachix 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "cachix", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Cachix", 13 | Homepage: sdk.URL("https://www.cachix.org"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AuthToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | CachixCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/crowdin/plugin.go: -------------------------------------------------------------------------------- 1 | package crowdin 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "crowdin", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Crowdin", 13 | Homepage: sdk.URL("https://crowdin.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | CrowdinCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/gitea/plugin.go: -------------------------------------------------------------------------------- 1 | package gitea 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "gitea", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Gitea", 13 | Homepage: sdk.URL("https://gitea.io/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | giteaCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/todoist/plugin.go: -------------------------------------------------------------------------------- 1 | package todoist 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "todoist", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Todoist", 13 | Homepage: sdk.URL("https://todoist.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | TodoistCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/akamai/plugin.go: -------------------------------------------------------------------------------- 1 | package akamai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "akamai", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Akamai", 13 | Homepage: sdk.URL("https://akamai.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIClientCredentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | AkamaiCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/atlas/plugin.go: -------------------------------------------------------------------------------- 1 | package atlas 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "atlas", 11 | Platform: schema.PlatformInfo{ 12 | Name: "MongoDB Atlas", 13 | Homepage: sdk.URL("https://www.mongodb.com/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | MongoDBAtlasCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/github/plugin.go: -------------------------------------------------------------------------------- 1 | package github 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "github", 11 | Platform: schema.PlatformInfo{ 12 | Name: "GitHub", 13 | Homepage: sdk.URL("https://github.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | GitHubCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/gitlab/plugin.go: -------------------------------------------------------------------------------- 1 | package gitlab 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "gitlab", 11 | Platform: schema.PlatformInfo{ 12 | Name: "GitLab", 13 | Homepage: sdk.URL("https://gitlab.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | GitLabCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/lacework/plugin.go: -------------------------------------------------------------------------------- 1 | package lacework 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "lacework", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Lacework", 13 | Homepage: sdk.URL("https://www.lacework.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | LaceworkCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/linode/plugin.go: -------------------------------------------------------------------------------- 1 | package linode 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "linode", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Linode", 13 | Homepage: sdk.URL("https://linode.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | LinodeCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/pulumi/plugin.go: -------------------------------------------------------------------------------- 1 | package pulumi 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "pulumi", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Pulumi", 13 | Homepage: sdk.URL("https://www.pulumi.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PulumiAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | PulumiCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/scaleway/plugin.go: -------------------------------------------------------------------------------- 1 | package scaleway 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "scaleway", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Scaleway", 13 | Homepage: sdk.URL("https://scaleway.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AccessKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ScalewayCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/tugboat/plugin.go: -------------------------------------------------------------------------------- 1 | package tugboat 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "tugboat", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Tugboat", 13 | Homepage: sdk.URL("https://tugboatqa.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | TugboatCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/zendesk/plugin.go: -------------------------------------------------------------------------------- 1 | package zendesk 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "zendesk", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Zendesk", 13 | Homepage: sdk.URL("https://www.zendesk.com/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ZendeskCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/flyctl/plugin.go: -------------------------------------------------------------------------------- 1 | package flyctl 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "flyctl", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Fly.io", 13 | Homepage: sdk.URL("https://fly.io"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | FlyctlCLI(), 20 | FlyCLI(), 21 | }, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /plugins/homebrew/plugin.go: -------------------------------------------------------------------------------- 1 | package homebrew 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "homebrew", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Homebrew", 13 | Homepage: sdk.URL("https://brew.sh/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | HomebrewCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/pipedream/plugin.go: -------------------------------------------------------------------------------- 1 | package pipedream 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "pipedream", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Pipedream", 13 | Homepage: sdk.URL("https://pipedream.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | PipedreamCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/vault/plugin.go: -------------------------------------------------------------------------------- 1 | package vault 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "vault", 11 | Platform: schema.PlatformInfo{ 12 | Name: "HashiCorp Vault", 13 | Homepage: sdk.URL("https://www.vaultproject.io"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AuthToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | VaultCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/circleci/plugin.go: -------------------------------------------------------------------------------- 1 | package circleci 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "circleci", 11 | Platform: schema.PlatformInfo{ 12 | Name: "CircleCI", 13 | Homepage: sdk.URL("https://circleci.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAPIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | CircleCICLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/hcloud/plugin.go: -------------------------------------------------------------------------------- 1 | package hcloud 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "hcloud", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Hetzner Cloud", 13 | Homepage: sdk.URL("https://console.hetzner.cloud"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | HetznerCloudCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/localstack/plugin.go: -------------------------------------------------------------------------------- 1 | package localstack 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "localstack", 11 | Platform: schema.PlatformInfo{ 12 | Name: "LocalStack", 13 | Homepage: sdk.URL("https://localstack.cloud"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | LocalStackCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/snowflake/plugin.go: -------------------------------------------------------------------------------- 1 | package snowflake 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "snowflake", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Snowflake", 13 | Homepage: sdk.URL("https://snowflake.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | LoginDetails(), 17 | }, 18 | Executables: []schema.Executable{ 19 | SnowflakeCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/vertica/plugin.go: -------------------------------------------------------------------------------- 1 | package vertica 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "vertica", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Vertica", 13 | Homepage: sdk.URL("https://www.vertica.com/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | DatabaseCredentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | VerticaCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/argocd/plugin.go: -------------------------------------------------------------------------------- 1 | package argocd 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "argocd", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Argo CD", 13 | Homepage: sdk.URL("https://argo-cd.readthedocs.io/en/stable/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AuthToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ArgocdCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/confluent/plugin.go: -------------------------------------------------------------------------------- 1 | package confluent 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "confluent", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Confluent", 13 | Homepage: sdk.URL("https://confluent.io"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | CloudCredentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | ConfluentCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/influxdb/plugin.go: -------------------------------------------------------------------------------- 1 | package influxdb 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "influxdb", 11 | Platform: schema.PlatformInfo{ 12 | Name: "InfluxDB", 13 | Homepage: sdk.URL("https://www.influxdata.com/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | DatabaseCredentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | InfluxDBCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/sourcegraph/plugin.go: -------------------------------------------------------------------------------- 1 | package sourcegraph 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "sourcegraph", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Sourcegraph", 13 | Homepage: sdk.URL("https://sourcegraph.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | SourcegraphCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/yugabytedb/plugin.go: -------------------------------------------------------------------------------- 1 | package yugabytedb 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "yugabytedb", 11 | Platform: schema.PlatformInfo{ 12 | Name: "YugabyteDB", 13 | Homepage: sdk.URL("https://yugabyte.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | DatabaseCredentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | YugabyteDBCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/databricks/plugin.go: -------------------------------------------------------------------------------- 1 | package databricks 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "databricks", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Databricks", 13 | Homepage: sdk.URL("https://databricks.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | DatabricksCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/huggingface/plugin.go: -------------------------------------------------------------------------------- 1 | package huggingface 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "huggingface", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Hugging Face", 13 | Homepage: sdk.URL("https://huggingface.co"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | UserAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | HuggingFaceCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/laravelforge/plugin.go: -------------------------------------------------------------------------------- 1 | package laravelforge 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "laravelforge", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Laravel Forge", 13 | Homepage: sdk.URL("https://forge.laravel.com/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | LaravelForgeCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/laravelvapor/plugin.go: -------------------------------------------------------------------------------- 1 | package laravelvapor 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "laravelvapor", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Laravel Vapor", 13 | Homepage: sdk.URL("https://vapor.laravel.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | LaravelVaporCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/akamai/test-fixtures/.edgerc-multiple: -------------------------------------------------------------------------------- 1 | [default] 2 | client_secret = abcdE23FNkBxy456z25qx9Yp5CPUxlEfQeTDkfh4QA=I 3 | host = akab-lmn789n2k53w7qrs-nfkxaa4lfk3kd6ym.luna.akamaiapis.net 4 | access_token = akab-zyx987xa6osbli4k-e7jf5ikib5jknes3 5 | client_token = akab-nomoflavjuc4422e-fa2xznerxrm3teg7 6 | 7 | [newcredential] 8 | client_secret = M9XGZP/D2JedcbABC4Td8XSnHfKKIV4N5n28cj2y6zE= 9 | host = akab-ip5n2k53w7nhdcxy-nflxabc432DE1ymd.luna.akamaiapis.net 10 | access_token = akab-abc77fxa6zyxi4k-e7jf5ikib5jknesc3 11 | client_token = akab-moo22awk8765efd-s2yw5zqfrx4jp57cf -------------------------------------------------------------------------------- /plugins/treasuredata/plugin.go: -------------------------------------------------------------------------------- 1 | package treasuredata 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "treasuredata", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Treasure Data", 13 | Homepage: sdk.URL("https://www.treasuredata.com/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | TreasureDataCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/wrangler/plugin.go: -------------------------------------------------------------------------------- 1 | package wrangler 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "wrangler", 11 | Platform: schema.PlatformInfo{ 12 | Name: "Cloudflare Workers", 13 | Homepage: sdk.URL("https://workers.cloudflare.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | CloudflareWorkersCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | linters: 2 | disable-all: true 3 | enable: 4 | # Defaults: 5 | - errcheck 6 | - gosimple 7 | - govet 8 | - ineffassign 9 | - staticcheck 10 | - typecheck 11 | - unused 12 | # Extra: 13 | - asciicheck 14 | - bidichk 15 | - depguard 16 | - goimports 17 | - gofmt 18 | 19 | linters-settings: 20 | depguard: 21 | list-type: blacklist 22 | include-go-root: false 23 | packages: 24 | - math/rand 25 | packages-with-error-message: 26 | - math/rand: "please use the safer crypto/rand" 27 | -------------------------------------------------------------------------------- /plugins/digitalocean/plugin.go: -------------------------------------------------------------------------------- 1 | package digitalocean 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "digitalocean", 11 | Platform: schema.PlatformInfo{ 12 | Name: "DigitalOcean", 13 | Homepage: sdk.URL("https://www.digitalocean.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | PersonalAccessToken(), 17 | }, 18 | Executables: []schema.Executable{ 19 | DigitalOceanCLI(), 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/twilio/test-fixtures/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "email": {}, 3 | "prompts": {}, 4 | "projects": [], 5 | "profiles": { 6 | "prod": { 7 | "accountSid": "ACtdgcL157CFBnWjM7ZeJKysIjEEXAMPLE", 8 | "apiKey": "SK4bqP76ByZgGEuwqm0eTFzYrWBEXAMPLE", 9 | "apiSecret": "1KAe9Vshg4EkUvaBVS8pZwDS1EXAMPLE" 10 | }, 11 | "dev": { 12 | "accountSid": "ACZBgJOUfaX2AuuLMWK7jT3tdS9EXAMPLE", 13 | "apiKey": "SKrhNjOV2LgR1xatOpVFsMa5fOpEXAMPLE", 14 | "apiSecret": "4ELE8BqwbCrzbyTqu7HNylK00EXAMPLE" 15 | } 16 | }, 17 | "activeProject": null 18 | } 19 | -------------------------------------------------------------------------------- /plugins/openai/plugin.go: -------------------------------------------------------------------------------- 1 | package openai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "openai", 11 | Platform: schema.PlatformInfo{ 12 | Name: "OpenAI", 13 | Homepage: sdk.URL("https://openai.com"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | APIKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | OpenAICLI(), 20 | OpenAIEvalsCLI(), 21 | OpenAIEvalSetCLI(), 22 | OpenAICodex(), 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/aws/plugin.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "aws", 11 | Platform: schema.PlatformInfo{ 12 | Name: "AWS", 13 | Homepage: sdk.URL("https://aws.amazon.com/"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | AccessKey(), 17 | }, 18 | Executables: []schema.Executable{ 19 | AWSCLI(), 20 | AWSCDKToolkit(), 21 | AWSSAMCLI(), 22 | eksctlCLI(), 23 | awslogsCli(), 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/postgresql/plugin.go: -------------------------------------------------------------------------------- 1 | package postgresql 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/schema" 6 | ) 7 | 8 | func New() schema.Plugin { 9 | return schema.Plugin{ 10 | Name: "postgresql", 11 | Platform: schema.PlatformInfo{ 12 | Name: "PostgreSQL", 13 | Homepage: sdk.URL("https://postgresql.org"), 14 | }, 15 | Credentials: []schema.CredentialType{ 16 | DatabaseCredentials(), 17 | }, 18 | Executables: []schema.Executable{ 19 | Psql(), 20 | Pg_dump(), 21 | Pg_restore(), 22 | Pgcli(), 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/flyctl/fly.go: -------------------------------------------------------------------------------- 1 | package flyctl 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func FlyCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Fly", 13 | Runs: []string{"fly"}, 14 | DocsURL: sdk.URL("https://fly.io/docs/flyctl/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.AccessToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/snyk/snyk.go: -------------------------------------------------------------------------------- 1 | package snyk 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func SnykCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Snyk CLI", 13 | Runs: []string{"snyk"}, 14 | DocsURL: sdk.URL("https://docs.snyk.io/snyk-cli"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/cachix/cachix.go: -------------------------------------------------------------------------------- 1 | package cachix 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func CachixCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Cachix CLI", 13 | Runs: []string{"cachix"}, 14 | DocsURL: sdk.URL("https://docs.cachix.org"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.AuthToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/flyctl/flyctl.go: -------------------------------------------------------------------------------- 1 | package flyctl 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func FlyctlCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Flyctl", 13 | Runs: []string{"flyctl"}, 14 | DocsURL: sdk.URL("https://fly.io/docs/flyctl/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.AccessToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/stripe/stripe.go: -------------------------------------------------------------------------------- 1 | package stripe 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func StripeCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Stripe CLI", 13 | Runs: []string{"stripe"}, 14 | DocsURL: sdk.URL("https://stripe.com/docs/cli"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.SecretKey, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/twilio/twilio.go: -------------------------------------------------------------------------------- 1 | package twilio 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func TwilioCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Twilio CLI", 13 | Runs: []string{"twilio"}, 14 | DocsURL: sdk.URL("https://twilio.com/docs/cli"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIKey, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sdk/example/example.go: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ExampleCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Example CLI", 13 | Runs: []string{"example"}, 14 | DocsURL: sdk.URL("http://example.com/docs/cli"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/openai/openai.go: -------------------------------------------------------------------------------- 1 | package openai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func OpenAICLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "OpenAI CLI", 13 | Runs: []string{"openai"}, 14 | DocsURL: sdk.URL("https://pypi.org/project/openai/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIKey, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/postgresql/pgcli.go: -------------------------------------------------------------------------------- 1 | package postgresql 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func Pgcli() schema.Executable { 11 | return schema.Executable{ 12 | Name: "pgcli", 13 | Runs: []string{"pgcli"}, 14 | DocsURL: sdk.URL("https://pgcli.com/docs"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.DatabaseCredentials, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sdk/provision/no_op.go: -------------------------------------------------------------------------------- 1 | package provision 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | ) 8 | 9 | type noOp struct { 10 | sdk.Provisioner 11 | } 12 | 13 | // NoOp can be used as a provisioner stub while developing plugins. 14 | func NoOp() sdk.Provisioner { 15 | return noOp{} 16 | } 17 | 18 | func (p noOp) Provision(ctx context.Context, in sdk.ProvisionInput, out *sdk.ProvisionOutput) { 19 | // No op 20 | } 21 | 22 | func (p noOp) Deprovision(ctx context.Context, in sdk.DeprovisionInput, out *sdk.DeprovisionOutput) { 23 | // No op 24 | } 25 | 26 | func (p noOp) Description() string { 27 | return "No op" 28 | } 29 | -------------------------------------------------------------------------------- /plugins/lacework/lacework.go: -------------------------------------------------------------------------------- 1 | package lacework 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func LaceworkCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Lacework CLI", 13 | Runs: []string{"lacework"}, 14 | DocsURL: sdk.URL("https://docs.lacework.com/cli/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIKey, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/mysql/mysql.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func Mysql() schema.Executable { 11 | return schema.Executable{ 12 | Name: "mysql", 13 | Runs: []string{"mysql"}, 14 | DocsURL: sdk.URL("https://dev.mysql.com/doc/refman/en/mysql.html"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.DatabaseCredentials, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/hcloud/hcloud.go: -------------------------------------------------------------------------------- 1 | package hcloud 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func HetznerCloudCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Hetzner Cloud CLI", 13 | Runs: []string{"hcloud"}, 14 | DocsURL: sdk.URL("https://github.com/hetznercloud/cli"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/tugboat/tugboat.go: -------------------------------------------------------------------------------- 1 | package tugboat 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func TugboatCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Tugboat CLI", 13 | Runs: []string{"tugboat"}, 14 | DocsURL: sdk.URL("https://docs.tugboatqa.com/tugboat-cli/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.AccessToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/vault/vault.go: -------------------------------------------------------------------------------- 1 | package vault 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func VaultCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Vault CLI", 13 | Runs: []string{"vault"}, 14 | DocsURL: sdk.URL("https://developer.hashicorp.com/vault/docs/commands"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.AuthToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sdk/importer/source.go: -------------------------------------------------------------------------------- 1 | package importer 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | ) 6 | 7 | func SourceEnvVars(envVars ...string) sdk.ImportSource { 8 | return sdk.ImportSource{Env: envVars} 9 | } 10 | 11 | func SourceEnvName(envVarName string) sdk.ImportSource { 12 | return sdk.ImportSource{Env: []string{envVarName}} 13 | } 14 | 15 | func SourceFile(filename string) sdk.ImportSource { 16 | return sdk.ImportSource{Files: []string{filename}} 17 | } 18 | 19 | func SourceOther(sourceType string, sourceValue string) sdk.ImportSource { 20 | return sdk.ImportSource{Other: sdk.CustomSource{Type: sourceType, Value: []string{sourceValue}}} 21 | } 22 | -------------------------------------------------------------------------------- /plugins/gitea/test-fixtures/import_config.yml: -------------------------------------------------------------------------------- 1 | logins: 2 | - name: git.example.com 3 | url: https://git.example.com 4 | token: oyyfsny27bgphldmhvffxhhlmqvdkzjrfslrsj9f 5 | default: false 6 | ssh_host: git.example.com 7 | ssh_key: ~/.ssh/id_ed25519 8 | insecure: false 9 | user: example 10 | created: 1479340800000 11 | - name: gitea.com 12 | url: https://gitea.com 13 | token: enjkarzu2ca5ffcnvzaczxncuczeoq9utlpqqrzs 14 | default: false 15 | ssh_host: git.example.com 16 | ssh_key: ~/.ssh/id_ed25519 17 | insecure: true 18 | user: example@example.com 19 | created: 1479340800000 20 | preferences: 21 | editor: false 22 | flag_defaults: 23 | remote: "" -------------------------------------------------------------------------------- /plugins/postgresql/psql.go: -------------------------------------------------------------------------------- 1 | package postgresql 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func Psql() schema.Executable { 11 | return schema.Executable{ 12 | Name: "psql", 13 | Runs: []string{"psql"}, 14 | DocsURL: sdk.URL("https://www.postgresql.org/docs/current/app-psql.html"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.DatabaseCredentials, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sdk/plugintest/needs_auth_test_helper.go: -------------------------------------------------------------------------------- 1 | package plugintest 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | type NeedsAuthCase struct { 11 | Args []string 12 | ExpectedNeedsAuth bool 13 | } 14 | 15 | func TestNeedsAuth(t *testing.T, rule sdk.NeedsAuthentication, cases map[string]NeedsAuthCase) { 16 | t.Helper() 17 | for name, c := range cases { 18 | t.Run(name, func(t *testing.T) { 19 | t.Helper() 20 | in := sdk.NeedsAuthenticationInput{ 21 | CommandArgs: c.Args, 22 | } 23 | assert.Equal(t, c.ExpectedNeedsAuth, rule(in), name) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/wrangler/wrangler.go: -------------------------------------------------------------------------------- 1 | package wrangler 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func CloudflareWorkersCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Cloudflare Workers CLI", 13 | Runs: []string{"wrangler"}, 14 | DocsURL: sdk.URL("https://wrangler.com/docs/cli"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/todoist/todoist.go: -------------------------------------------------------------------------------- 1 | package todoist 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func TodoistCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Todoist CLI", 13 | Runs: []string{"todoist"}, 14 | DocsURL: sdk.URL("https://github.com/sachaos/todoist"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | ), 18 | Uses: []schema.CredentialUsage{ 19 | { 20 | Name: credname.APIToken, 21 | }, 22 | }, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/check-flake.yml: -------------------------------------------------------------------------------- 1 | name: Check Nix flake 2 | on: 3 | pull_request: 4 | paths: 5 | - '**.nix' 6 | - flake.lock 7 | push: 8 | branches: 9 | - main 10 | jobs: 11 | check-flake: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: DeterminateSystems/nix-installer-action@main 16 | - uses: DeterminateSystems/magic-nix-cache-action@main 17 | - name: Check Nix flake inputs 18 | uses: DeterminateSystems/flake-checker-action@v5 19 | with: 20 | fail-mode: true 21 | send-statistics: false 22 | - name: Run nix flake check 23 | run: nix flake check 24 | -------------------------------------------------------------------------------- /plugins/argocd/argocd.go: -------------------------------------------------------------------------------- 1 | package argocd 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ArgocdCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Argo CD CLI", 13 | Runs: []string{"argocd"}, 14 | DocsURL: sdk.URL("https://argo-cd.readthedocs.io/en/stable/user-guide/commands/argocd/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.AuthToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/okta/okta.go: -------------------------------------------------------------------------------- 1 | package okta 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func OktaCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Okta CLI", 13 | Runs: []string{"okta"}, 14 | DocsURL: sdk.URL("https://cli.okta.com"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/postgresql/pg_dump.go: -------------------------------------------------------------------------------- 1 | package postgresql 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func Pg_dump() schema.Executable { 11 | return schema.Executable{ 12 | Name: "pg_dump", 13 | Runs: []string{"pg_dump"}, 14 | DocsURL: sdk.URL("https://www.postgresql.org/docs/current/app-pgdump.html"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.DatabaseCredentials, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/databricks/databricks.go: -------------------------------------------------------------------------------- 1 | package databricks 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func DatabricksCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Databricks CLI", 13 | Runs: []string{"databricks"}, 14 | DocsURL: sdk.URL("https://docs.databricks.com/dev-tools/cli/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.PersonalAccessToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/linode/linode-cli.go: -------------------------------------------------------------------------------- 1 | package linode 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func LinodeCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Linode CLI", 13 | Runs: []string{"linode-cli"}, 14 | DocsURL: sdk.URL("https://www.linode.com/docs/products/tools/cli/get-started/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.PersonalAccessToken, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/openai/codex.go: -------------------------------------------------------------------------------- 1 | package openai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func OpenAICodex() schema.Executable { 11 | return schema.Executable{ 12 | Name: "OpenAI Codex", 13 | Runs: []string{"codex"}, 14 | DocsURL: sdk.URL("https://help.openai.com/en/articles/11096431-openai-codex-cli-getting-started"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIKey, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/postgresql/pg_restore.go: -------------------------------------------------------------------------------- 1 | package postgresql 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func Pg_restore() schema.Executable { 11 | return schema.Executable{ 12 | Name: "pg_restore", 13 | Runs: []string{"pg_restore"}, 14 | DocsURL: sdk.URL("https://www.postgresql.org/docs/current/app-pgrestore.html"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.DatabaseCredentials, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sdk/plugintest/test_fixture_helper.go: -------------------------------------------------------------------------------- 1 | package plugintest 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | "runtime" 7 | "testing" 8 | ) 9 | 10 | // LoadFixture loads the test fixture file from the "test-fixtures" dir in the plugin directory. 11 | // It fails the test if the file can't be loaded. 12 | func LoadFixture(t *testing.T, filename string) string { 13 | t.Helper() 14 | 15 | _, testFilename, _, ok := runtime.Caller(1) 16 | if !ok { 17 | t.Fatal() 18 | } 19 | 20 | fixturePath := filepath.Join(filepath.Dir(testFilename), "test-fixtures", filename) 21 | contents, err := os.ReadFile(fixturePath) 22 | if err != nil { 23 | t.Fatal(err) 24 | } 25 | 26 | return string(contents) 27 | } 28 | -------------------------------------------------------------------------------- /plugins/fossa/fossa.go: -------------------------------------------------------------------------------- 1 | package fossa 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func FOSSACLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "FOSSA CLI", 13 | Runs: []string{"fossa"}, 14 | DocsURL: sdk.URL("https://github.com/fossas/fossa-cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/datadog/dogshell.go: -------------------------------------------------------------------------------- 1 | package datadog 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func Dogshell() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Dogshell", 13 | Runs: []string{"dog"}, 14 | DocsURL: sdk.URL("https://docs.datadoghq.com/developers/guide/dogshell-quickly-use-datadog-s-api-from-terminal-shell/"), 15 | NeedsAuth: needsauth.NotForHelpOrVersion(), 16 | Uses: []schema.CredentialUsage{ 17 | { 18 | Name: credname.APIKey, 19 | }, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugins/gitlab/glab.go: -------------------------------------------------------------------------------- 1 | package gitlab 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func GitLabCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "GitLab CLI", 13 | Runs: []string{"glab"}, 14 | DocsURL: sdk.URL("https://glab.readthedocs.io"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.PersonalAccessToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/kaggle/kaggle.go: -------------------------------------------------------------------------------- 1 | package kaggle 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func KaggleCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Kaggle CLI", 13 | Runs: []string{"kaggle"}, 14 | DocsURL: sdk.URL("https://github.com/Kaggle/kaggle-api"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/scaleway/scw.go: -------------------------------------------------------------------------------- 1 | package scaleway 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ScalewayCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Scaleway CLI", 13 | Runs: []string{"scw"}, 14 | DocsURL: sdk.URL("https://www.scaleway.com/en/cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.AccessKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/axiom/axiom.go: -------------------------------------------------------------------------------- 1 | package axiom 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func AxiomCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Axiom CLI", 13 | Runs: []string{"axiom"}, 14 | DocsURL: sdk.URL("https://axiom.co/docs/reference/cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.PersonalAccessToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/yugabytedb/ysqlsh.go: -------------------------------------------------------------------------------- 1 | package yugabytedb 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func YugabyteDBCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "YugabyteDB SQL Shell", 13 | Runs: []string{"ysqlsh"}, 14 | DocsURL: sdk.URL("https://docs.yugabyte.com/preview/admin/ysqlsh/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | ), 18 | Uses: []schema.CredentialUsage{ 19 | { 20 | Name: credname.DatabaseCredentials, 21 | }, 22 | }, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /plugins/zapier/zapier.go: -------------------------------------------------------------------------------- 1 | package zapier 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ZapierCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Zapier CLI", 13 | Runs: []string{"zapier"}, 14 | DocsURL: sdk.URL("https://platform.zapier.com/cli_docs/docs"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.DeployKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/heroku/heroku.go: -------------------------------------------------------------------------------- 1 | package heroku 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func HerokuCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Heroku CLI", 13 | Runs: []string{"heroku"}, 14 | DocsURL: sdk.URL("https://devcenter.heroku.com/articles/heroku-cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/sourcegraph/src.go: -------------------------------------------------------------------------------- 1 | package sourcegraph 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func SourcegraphCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Sourcegraph CLI", 13 | Runs: []string{"src"}, 14 | DocsURL: sdk.URL("https://docs.sourcegraph.com/cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.AccessToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/atlas/atlas.go: -------------------------------------------------------------------------------- 1 | package atlas 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func MongoDBAtlasCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "MongoDB Atlas CLI", 13 | Runs: []string{"atlas"}, 14 | DocsURL: sdk.URL("https://www.mongodb.com/docs/atlas/cli/stable/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/ohdear/ohdear.go: -------------------------------------------------------------------------------- 1 | package ohdear 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func OhDearCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Oh Dear CLI", 13 | Runs: []string{"ohdear"}, 14 | DocsURL: sdk.URL("https://ohdear.app/docs/integrations/our-cli-tool"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/pulumi/pulumi.go: -------------------------------------------------------------------------------- 1 | package pulumi 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func PulumiCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Pulumi CLI", 13 | Runs: []string{"pulumi"}, 14 | DocsURL: sdk.URL("https://www.pulumi.com/docs/reference/cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.PersonalAccessToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/aws/aws.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func AWSCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "AWS CLI", 13 | Runs: []string{"aws"}, 14 | DocsURL: sdk.URL("https://aws.amazon.com/cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.AccessKey, 22 | Provisioner: CLIProvisioner{}, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 4 | systems.url = "github:nix-systems/default"; 5 | }; 6 | outputs = { nixpkgs, systems, ... }: 7 | let 8 | forAllSystems = function: 9 | nixpkgs.lib.genAttrs (import systems) ( 10 | system: function nixpkgs.legacyPackages.${system} 11 | ); 12 | in 13 | { 14 | devShells = forAllSystems (pkgs: { 15 | default = pkgs.mkShell { 16 | name = "Shell with Go toolchain"; 17 | packages = with pkgs; [ go gopls ]; 18 | }; 19 | }); 20 | 21 | nixosModules.default = import ./nix/nixos.nix; 22 | hmModules.default = import ./nix/home-manager.nix; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /plugins/aws/eksctl.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func eksctlCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "eksctl CLI", 13 | Runs: []string{"eksctl"}, 14 | DocsURL: sdk.URL("https://eksctl.io/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.AccessKey, 22 | Provisioner: CLIProvisioner{}, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/openai/oaieval.go: -------------------------------------------------------------------------------- 1 | package openai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func OpenAIEvalsCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "OpenAI Evals CLI", 13 | Runs: []string{"oaieval"}, 14 | DocsURL: sdk.URL("https://github.com/openai/evals/blob/main/docs/run-evals.md"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/vertica/vsql.go: -------------------------------------------------------------------------------- 1 | package vertica 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func VerticaCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Vertica CLI", 13 | Runs: []string{"vsql"}, 14 | DocsURL: sdk.URL("https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/ConnectingToVertica/vsql/UsingVsql.htm"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | ), 18 | Uses: []schema.CredentialUsage{ 19 | { 20 | Name: credname.DatabaseCredentials, 21 | }, 22 | }, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /plugins/digitalocean/doctl.go: -------------------------------------------------------------------------------- 1 | package digitalocean 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func DigitalOceanCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "DigitalOcean CLI", 13 | Runs: []string{"doctl"}, 14 | DocsURL: sdk.URL("https://docs.digitalocean.com/reference/doctl"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.PersonalAccessToken, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/github/gh.go: -------------------------------------------------------------------------------- 1 | package github 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func GitHubCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "GitHub CLI", 13 | Runs: []string{"gh"}, 14 | DocsURL: sdk.URL("https://cli.github.com"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("__complete"), 19 | ), 20 | Uses: []schema.CredentialUsage{ 21 | { 22 | Name: credname.PersonalAccessToken, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/aws/awslogs.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func awslogsCli() schema.Executable { 11 | return schema.Executable{ 12 | Name: "awslogs", 13 | Runs: []string{"awslogs"}, 14 | DocsURL: sdk.URL("https://github.com/jorgebastida/awslogs"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.AccessKey, 22 | Provisioner: CLIProvisioner{}, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/openai/oaievalset.go: -------------------------------------------------------------------------------- 1 | package openai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func OpenAIEvalSetCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "OpenAI Eval Set CLI", 13 | Runs: []string{"oaievalset"}, 14 | DocsURL: sdk.URL("https://github.com/openai/evals/blob/main/docs/run-evals.md"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/vultr/vultr-cli.go: -------------------------------------------------------------------------------- 1 | package vultr 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func VultrCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Vultr CLI", 13 | Runs: []string{"vultr-cli"}, 14 | DocsURL: sdk.URL("https://github.com/vultr/vultr-cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotWhenContainsArgs("--config"), 17 | needsauth.NotForHelpOrVersion(), 18 | needsauth.NotWithoutArgs(), 19 | ), 20 | Uses: []schema.CredentialUsage{ 21 | { 22 | Name: credname.APIKey, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/aws/cdk.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func AWSCDKToolkit() schema.Executable { 11 | return schema.Executable{ 12 | Name: "AWS CDK Toolkit", 13 | Runs: []string{"cdk"}, 14 | DocsURL: sdk.URL("https://docs.aws.amazon.com/cdk/v2/guide/cli.html"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.AccessKey, 22 | Provisioner: CLIProvisioner{}, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/crowdin/crowdin.go: -------------------------------------------------------------------------------- 1 | package crowdin 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func CrowdinCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Crowdin CLI", 13 | Runs: []string{"crowdin"}, 14 | DocsURL: sdk.URL("https://crowdin.github.io/crowdin-cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotForExactArgs("init"), 19 | ), 20 | Uses: []schema.CredentialUsage{ 21 | { 22 | Name: credname.AccessToken, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/gitea/tea.go: -------------------------------------------------------------------------------- 1 | package gitea 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func giteaCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Gitea CLI", 13 | Runs: []string{"tea"}, 14 | DocsURL: sdk.URL("https://gitea.com/gitea/tea/src/branch/main/README.md"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotForExactArgs("h"), 19 | ), 20 | Uses: []schema.CredentialUsage{ 21 | { 22 | Name: credname.PersonalAccessToken, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/localstack/localstack.go: -------------------------------------------------------------------------------- 1 | package localstack 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func LocalStackCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "LocalStack CLI", 13 | Runs: []string{"localstack"}, 14 | DocsURL: sdk.URL("https://docs.localstack.cloud/getting-started/installation/#localstack-cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | ), 19 | Uses: []schema.CredentialUsage{ 20 | { 21 | Name: credname.APIKey, 22 | }, 23 | }, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/circleci/circleci.go: -------------------------------------------------------------------------------- 1 | package circleci 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func CircleCICLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "CircleCI CLI", 13 | Runs: []string{"circleci"}, 14 | DocsURL: sdk.URL("https://circleci.com/docs/local-cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotForExactArgs("config"), 19 | ), 20 | Uses: []schema.CredentialUsage{ 21 | { 22 | Name: credname.PersonalAPIToken, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/registry_test.go: -------------------------------------------------------------------------------- 1 | package plugins 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestValidatePlugins(t *testing.T) { 11 | for _, p := range registry { 12 | _, report := p.Validate() 13 | for _, c := range report.Checks { 14 | if !c.Assertion && c.Severity == schema.ValidationSeverityError { 15 | t.Logf("The '%s' plugin has validation errors: %s", p.Name, c.Description) 16 | t.Fail() 17 | } 18 | } 19 | } 20 | } 21 | 22 | func TestAllPluginsHaveUniqueNames(t *testing.T) { 23 | var pluginNames []string 24 | for _, p := range registry { 25 | pluginNames = append(pluginNames, p.Name) 26 | } 27 | 28 | assert.True(t, schema.IsStringSliceASet(pluginNames)) 29 | } 30 | -------------------------------------------------------------------------------- /plugins/sentry/sentry_cli.go: -------------------------------------------------------------------------------- 1 | package sentry 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func SentryCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Sentry CLI", 13 | Runs: []string{"sentry-cli"}, 14 | DocsURL: sdk.URL("https://docs.sentry.io/product/cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWhenContainsArgs("--auth-token"), 18 | needsauth.NotWhenContainsArgs("--api-key"), 19 | ), 20 | Uses: []schema.CredentialUsage{ 21 | { 22 | Name: credname.AuthToken, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/influxdb/influx.go: -------------------------------------------------------------------------------- 1 | package influxdb 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func InfluxDBCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "InfluxDB CLI", 13 | Runs: []string{"influx"}, 14 | DocsURL: sdk.URL("https://docs.influxdata.com/influxdb/cloud/tools/influx-cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("config"), 19 | ), 20 | Uses: []schema.CredentialUsage{ 21 | { 22 | Name: credname.DatabaseCredentials, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/civo/civo.go: -------------------------------------------------------------------------------- 1 | package civo 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func CivoCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Civo CLI", 13 | Runs: []string{"civo"}, 14 | DocsURL: sdk.URL("https://www.civo.com/docs/overview/civo-cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotForExactArgs("config"), 19 | needsauth.NotWhenContainsArgs("apikey", "save"), 20 | ), 21 | Uses: []schema.CredentialUsage{ 22 | { 23 | Name: credname.APIKey, 24 | }, 25 | }, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugins/pipedream/pd.go: -------------------------------------------------------------------------------- 1 | package pipedream 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func PipedreamCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Pipedream CLI", 13 | Runs: []string{"pd"}, 14 | DocsURL: sdk.URL("https://pipedream.com/docs/cli/reference/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("-p"), 19 | needsauth.NotWhenContainsArgs("--profile"), 20 | ), 21 | Uses: []schema.CredentialUsage{ 22 | { 23 | Name: credname.APIKey, 24 | }, 25 | }, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugins/cargo/cargo.go: -------------------------------------------------------------------------------- 1 | package cargo 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func CargoCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Cargo CLI", 13 | Runs: []string{"cargo"}, 14 | DocsURL: sdk.URL("https://doc.rust-lang.org/cargo/index.html"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.IfAny( 17 | needsauth.ForCommand("publish"), 18 | needsauth.ForCommand("yank"), 19 | needsauth.ForCommand("owner"), 20 | ), 21 | needsauth.NotForHelp(), 22 | ), 23 | Uses: []schema.CredentialUsage{ 24 | { 25 | Name: credname.APIToken, 26 | }, 27 | }, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /plugins/hcloud/api_token_test.go: -------------------------------------------------------------------------------- 1 | package hcloud 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestImportingTheHetznerConfig(t *testing.T) { 12 | expectedFields := map[sdk.FieldName]string{ 13 | fieldname.Token: "dcAuOpQaCNvjzsNPmeGXvegHBdq4Zamx8QjI8ibxfErzy34fjL4ZOITFvdP5SKct", 14 | } 15 | 16 | plugintest.TestImporter(t, APIToken().Importer, map[string]plugintest.ImportCase{ 17 | "Hcloud config file": { 18 | Files: map[string]string{ 19 | "~/.config/hcloud/cli.toml": plugintest.LoadFixture(t, "hcloud.toml"), 20 | }, 21 | ExpectedCandidates: []sdk.ImportCandidate{ 22 | {Fields: expectedFields, NameHint: ""}, 23 | }, 24 | }, 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /plugins/treasuredata/td.go: -------------------------------------------------------------------------------- 1 | package treasuredata 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func TreasureDataCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Treasure Data Toolbelt", 13 | Runs: []string{"td"}, 14 | DocsURL: sdk.URL("https://docs.treasuredata.com/display/public/PD/TD+Toolbelt"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("-k"), 19 | needsauth.NotWhenContainsArgs("-c"), 20 | ), 21 | Uses: []schema.CredentialUsage{ 22 | { 23 | Name: credname.APIKey, 24 | }, 25 | }, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugins/vercel/vercel.go: -------------------------------------------------------------------------------- 1 | package vercel 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func VercelCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Vercel CLI", 13 | Runs: []string{"vercel"}, 14 | DocsURL: sdk.URL("https://vercel.com/docs/cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("login"), 19 | needsauth.NotWhenContainsArgs("-t"), 20 | needsauth.NotWhenContainsArgs("--token"), 21 | ), 22 | Uses: []schema.CredentialUsage{ 23 | { 24 | Name: credname.APIToken, 25 | }, 26 | }, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /plugins/upstash/upstash.go: -------------------------------------------------------------------------------- 1 | package upstash 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func UpstashCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Upstash CLI", 13 | Runs: []string{"upstash"}, 14 | DocsURL: sdk.URL("https://github.com/upstash/cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("--config"), 19 | needsauth.NotWhenContainsArgs("-c"), 20 | needsauth.NotWhenContainsArgs("auth"), 21 | ), 22 | Uses: []schema.CredentialUsage{ 23 | { 24 | Name: credname.APIKey, 25 | }, 26 | }, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /plugins/laravelvapor/vapor.go: -------------------------------------------------------------------------------- 1 | package laravelvapor 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func LaravelVaporCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Laravel Vapor CLI", 13 | Runs: []string{"vapor"}, 14 | DocsURL: sdk.URL("https://docs.vapor.build/1.0/introduction.html#installing-the-vapor-cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotForExactArgs("login"), 19 | needsauth.NotForExactArgs("list"), 20 | ), 21 | Uses: []schema.CredentialUsage{ 22 | { 23 | Name: credname.APIToken, 24 | }, 25 | }, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugins/huggingface/huggingface-cli.go: -------------------------------------------------------------------------------- 1 | package huggingface 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func HuggingFaceCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "HuggingFace CLI", 13 | Runs: []string{"huggingface-cli"}, 14 | DocsURL: sdk.URL("https://huggingface.co/docs/huggingface_hub/quick-start"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("login"), 19 | needsauth.NotWhenContainsArgs("logout"), 20 | ), 21 | Uses: []schema.CredentialUsage{ 22 | { 23 | Name: credname.APIToken, 24 | }, 25 | }, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugins/laravelforge/forge.go: -------------------------------------------------------------------------------- 1 | package laravelforge 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func LaravelForgeCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Laravel Forge CLI", 13 | Runs: []string{"forge"}, 14 | DocsURL: sdk.URL("https://forge.laravel.com/docs/1.0/cli.html"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotForExactArgs("login"), 19 | needsauth.NotForExactArgs("logout"), 20 | needsauth.NotForExactArgs("list"), 21 | ), 22 | Uses: []schema.CredentialUsage{ 23 | { 24 | Name: credname.APIToken, 25 | }, 26 | }, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sdk/plugintest/validation_report_test.go: -------------------------------------------------------------------------------- 1 | package plugintest 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestValidationReportPrinter_printFields(t *testing.T) { 11 | printer := &ValidationReportPrinter{} 12 | checks := []schema.ValidationCheck{ 13 | {Description: "error", Assertion: false, Severity: schema.ValidationSeverityError}, 14 | {Description: "success", Assertion: true}, 15 | {Description: "warning", Assertion: false, Severity: schema.ValidationSeverityWarning}, 16 | } 17 | checks = printer.sortChecks(checks) 18 | assert.Equal(t, "success", checks[0].Description, "first check should be success") 19 | assert.Equal(t, "warning", checks[1].Description, "second check should be warning") 20 | assert.Equal(t, "error", checks[2].Description, "third check should be error") 21 | } 22 | -------------------------------------------------------------------------------- /plugins/fastly/fastly.go: -------------------------------------------------------------------------------- 1 | package fastly 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func FastlyCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Fastly CLI", 13 | Runs: []string{"fastly"}, 14 | DocsURL: sdk.URL("https://developer.fastly.com/reference/cli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("-t"), 19 | needsauth.NotWhenContainsArgs("--token"), 20 | needsauth.NotWhenContainsArgs("profile"), 21 | needsauth.NotWhenContainsArgs("config"), 22 | ), 23 | Uses: []schema.CredentialUsage{ 24 | { 25 | Name: credname.APIToken, 26 | }, 27 | }, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sdk/rpc/server/plugin.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "errors" 5 | "net/rpc" 6 | 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/hashicorp/go-plugin" 9 | ) 10 | 11 | // RPCPlugin is an implementation of the github.com/hashicorp/go-plugin#Plugin interface indicating how 12 | // to serve a Shell Plugin over RPC using go-plugin. 13 | type RPCPlugin struct { 14 | RPCPlugin func() (schema.Plugin, error) 15 | } 16 | 17 | // Server registers the RPC provider server with the RPC server that 18 | // go-plugin is setting up. 19 | func (p *RPCPlugin) Server(*plugin.MuxBroker) (any, error) { 20 | pl, err := p.RPCPlugin() 21 | if err != nil { 22 | return nil, err 23 | } 24 | 25 | return newServer(pl), nil 26 | } 27 | 28 | // Client always returns an error; we're only implementing a server. 29 | func (p *RPCPlugin) Client(*plugin.MuxBroker, *rpc.Client) (any, error) { 30 | return nil, errors.New("only server is implemented") 31 | } 32 | -------------------------------------------------------------------------------- /plugins/influxdb/database_credentials_test.go: -------------------------------------------------------------------------------- 1 | package influxdb 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestDatabaseCredentialsProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, DatabaseCredentials().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Host: "https://us-west-2-1.aws.cloud2.influxdata.com", 16 | fieldname.Organization: "1Password.com", 17 | fieldname.AccessToken: "BHsmEerxKV2yDaNNv31lPHMEXAMPLE", 18 | }, 19 | ExpectedOutput: sdk.ProvisionOutput{ 20 | Environment: map[string]string{ 21 | "INFLUX_HOST": "https://us-west-2-1.aws.cloud2.influxdata.com", 22 | "INFLUX_ORG": "1Password.com", 23 | "INFLUX_TOKEN": "BHsmEerxKV2yDaNNv31lPHMEXAMPLE", 24 | }, 25 | }, 26 | }, 27 | }) 28 | } 29 | -------------------------------------------------------------------------------- /plugins/laravelvapor/test-fixtures/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiYWFhODU2M2NkYjU5YzQyMmRkMGFlOTRlNTVjZTFjYzRiNjEwNzE3MTBiMTIzYWEzMzczNzc3MjIxOGVjN2Q5Yzc1MjgxYWEwNTVhOTFkZWQiLCJpYXQiOjE2ODEzNzUyMTkuNDg1NTUzLCJuYmYiOjE2ODEzNzUyMTkuNDg1NTU2LCJleHAiOjE5OTY5OTQ0MTkuNDc5MzUyLCJzdWIiOiIxNjkyMzQiLCJzY29wZXMiOltdfQ.a1Ny2UAzgSkKZGaXjrFBmjFuBAWerLj73l-ktK1iGmdCukD_9AXo75rsOq-BV11GWbZb1ws0LX_hkcSBKwxaD7ou_l9cQlkOM8vWni1dq0Vjd1OwctqemBqFl1SD-Gyw7-st7phELyZK77BVpyUu0oTAtRAREx0ybDj3UE672JF9LwgtOo7Nv2TUTWT-rlZPUIvOcwxliE-sWA29tPZOviRIveQ3-O3Bh8-LKY7gVjQv0UDfR3SM4SEPPuacaVRR5rnklFKlaar4sfnL5WL6-iazQ8o1J7IuNsBfDf9OJqslvtzQFg6GWcSC0AzxWsho5tzyvmsbbhSA5iOFZ7NMB93V53fByBDz4gLWD90HS0jYQ-gOVqOQBWrTJMuPu4C2TDpuow27Kc4rJrH6cKd7mZnf8B910jHPzlkEY33ommCT9Oe6C-wDGpM4CnUaVb9jaNMl67j2Ak7-pUzv7iiAajt5_Rhb4C7Kx9wFTZR6AIbP2GAfc4gXhOXWxV8tXz5LBJ_JXwgTDIfnBfqqKeYZ-GyCMmly6w2suxLwR00e4JCu1_LjDGoWA8-VPOVafhwA51t5nQ0HVzeyuEpVfqwRhsjk2ln56CY8sLd2YU12fPJiitN88t8YccLDugc8Q79OelJTgIO17d50kzXZ1twzwpimWTjgCIS90K19EXAMPLE", 3 | "team": 0 4 | } -------------------------------------------------------------------------------- /plugins/homebrew/brew.go: -------------------------------------------------------------------------------- 1 | package homebrew 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func HomebrewCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Homebrew CLI", 13 | Runs: []string{"brew"}, 14 | DocsURL: sdk.URL("https://brew.sh/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.IfAny( 18 | needsauth.ForCommand("search"), 19 | needsauth.ForCommand("bump"), 20 | needsauth.ForCommand("bump-cask-pr"), 21 | needsauth.ForCommand("bump-formula-pr"), 22 | needsauth.ForCommand("update"), 23 | needsauth.ForCommand("upgrade"), 24 | needsauth.ForCommand("install"), 25 | needsauth.ForCommand("reinstall"), 26 | ), 27 | ), 28 | Uses: []schema.CredentialUsage{ 29 | { 30 | Name: credname.PersonalAccessToken, 31 | }, 32 | }, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /plugins/aws/cache_utils.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/aws/aws-sdk-go-v2/aws" 8 | ) 9 | 10 | const ( 11 | mfaCacheKeyID = "sts-mfa" 12 | assumeRoleCacheKeyID = "sts-assume-role" 13 | ) 14 | 15 | // stsCacheWriter writes aws temp credentials to cache using the awsCacheKey 16 | type stsCacheWriter struct { 17 | awsCacheKey string 18 | cache sdk.CacheOperations 19 | } 20 | 21 | func (c stsCacheWriter) Put(credentials aws.Credentials) error { 22 | return c.cache.Put(c.awsCacheKey, credentials, credentials.Expires) 23 | } 24 | 25 | func NewSTSCacheWriter(key string, cache sdk.CacheOperations) stsCacheWriter { 26 | return stsCacheWriter{ 27 | awsCacheKey: key, 28 | cache: cache, 29 | } 30 | } 31 | 32 | func getRoleCacheKey(roleArn string, accessKeyID string) string { 33 | return fmt.Sprintf("%s|%s|%s", assumeRoleCacheKeyID, accessKeyID, roleArn) 34 | } 35 | 36 | func getMfaCacheKey(accessKeyID string) string { 37 | return fmt.Sprintf("%s|%s", mfaCacheKeyID, accessKeyID) 38 | } 39 | -------------------------------------------------------------------------------- /plugins/confluent/confluent.go: -------------------------------------------------------------------------------- 1 | package confluent 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ConfluentCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Confluent CLI", 13 | Runs: []string{"confluent"}, 14 | DocsURL: sdk.URL("https://docs.confluent.io/confluent-cli/current/overview.html"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotForExactArgs("local"), 18 | needsauth.NotForExactArgs("update"), 19 | needsauth.NotForExactArgs("prompt"), 20 | needsauth.NotForExactArgs("plugin"), 21 | needsauth.NotForExactArgs("logout"), 22 | needsauth.NotForExactArgs("context"), 23 | needsauth.NotForExactArgs("completion"), 24 | needsauth.NotForExactArgs("cloud-signup"), 25 | ), 26 | Uses: []schema.CredentialUsage{ 27 | { 28 | Name: credname.UserLogin, 29 | }, 30 | }, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugins/readme/rdme_test.go: -------------------------------------------------------------------------------- 1 | package readme 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk/plugintest" 7 | ) 8 | 9 | func TestRdmeNeedsAuth(t *testing.T) { 10 | plugintest.TestNeedsAuth(t, ReadMeCLI().NeedsAuth, map[string]plugintest.NeedsAuthCase{ 11 | "yes for docs command": { 12 | Args: []string{"docs"}, 13 | ExpectedNeedsAuth: true, 14 | }, 15 | "no for docs command help": { 16 | Args: []string{"docs", "--help"}, 17 | ExpectedNeedsAuth: false, 18 | }, 19 | "no for open command": { 20 | Args: []string{"open"}, 21 | ExpectedNeedsAuth: false, 22 | }, 23 | "no for version": { 24 | Args: []string{"--version"}, 25 | ExpectedNeedsAuth: false, 26 | }, 27 | "yes for openapi with --version flag": { 28 | Args: []string{"openapi", "--version", "2.0"}, 29 | ExpectedNeedsAuth: true, 30 | }, 31 | "no for openapi with --key flag": { 32 | Args: []string{"openapi", "--key", "rdme_test"}, 33 | ExpectedNeedsAuth: false, 34 | }, 35 | }) 36 | } 37 | -------------------------------------------------------------------------------- /plugins/snowflake/snowsql.go: -------------------------------------------------------------------------------- 1 | package snowflake 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func SnowflakeCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Snowflake CLI", 13 | Runs: []string{"snowsql"}, 14 | DocsURL: sdk.URL("https://docs.snowflake.com/en/user-guide/snowsql.html"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWhenContainsArgs("-a"), 18 | needsauth.NotWhenContainsArgs("--accountname"), 19 | needsauth.NotWhenContainsArgs("-u"), 20 | needsauth.NotWhenContainsArgs("--username"), 21 | needsauth.NotWhenContainsArgs("--authenticator"), 22 | needsauth.NotWhenContainsArgs("--config"), 23 | needsauth.NotWhenContainsArgs("-P"), 24 | needsauth.NotWhenContainsArgs("--prompt"), 25 | ), 26 | Uses: []schema.CredentialUsage{ 27 | { 28 | Name: credname.LoginDetails, 29 | }, 30 | }, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugins/aws/sam.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func AWSSAMCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "AWS SAM CLI", 13 | Runs: []string{"sam"}, 14 | DocsURL: sdk.URL("https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/reference-sam-cli.html"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | // skip 1Password authentication for "sam docs", "sam init", "sam local" and "sam validate" and their subcommands 19 | needsauth.NotWhenContainsArgs("docs"), 20 | needsauth.NotWhenContainsArgs("init"), 21 | needsauth.NotWhenContainsArgs("local"), 22 | needsauth.NotWhenContainsArgs("validate"), 23 | ), 24 | Uses: []schema.CredentialUsage{ 25 | { 26 | Name: credname.AccessKey, 27 | Provisioner: CLIProvisioner{}, 28 | }, 29 | }, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /plugins/laravelforge/test-fixtures/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "latest_version_verified_at": 1681372610, 3 | "latest_version": "v1.7.0", 4 | "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiYWFhODU2M2NkYjU5YzQyMmRkMGFlOTRlNTVjZTFjYzRiNjEwNzE3MTBiMTIzYWEzMzczNzc3MjIxOGVjN2Q5Yzc1MjgxYWEwNTVhOTFkZWQiLCJpYXQiOjE2ODEzNzUyMTkuNDg1NTUzLCJuYmYiOjE2ODEzNzUyMTkuNDg1NTU2LCJleHAiOjE5OTY5OTQ0MTkuNDc5MzUyLCJzdWIiOiIxNjkyMzQiLCJzY29wZXMiOltdfQ.a1Ny2UAzgSkKZGaXjrFBmjFuBAWerLj73l-ktK1iGmdCukD_9AXo75rsOq-BV11GWbZb1ws0LX_hkcSBKwxaD7ou_l9cQlkOM8vWni1dq0Vjd1OwctqemBqFl1SD-Gyw7-st7phELyZK77BVpyUu0oTAtRAREx0ybDj3UE672JF9LwgtOo7Nv2TUTWT-rlZPUIvOcwxliE-sWA29tPZOviRIveQ3-O3Bh8-LKY7gVjQv0UDfR3SM4SEPPuacaVRR5rnklFKlaar4sfnL5WL6-iazQ8o1J7IuNsBfDf9OJqslvtzQFg6GWcSC0AzxWsho5tzyvmsbbhSA5iOFZ7NMB93V53fByBDz4gLWD90HS0jYQ-gOVqOQBWrTJMuPu4C2TDpuow27Kc4rJrH6cKd7mZnf8B910jHPzlkEY33ommCT9Oe6C-wDGpM4CnUaVb9jaNMl67j2Ak7-pUzv7iiAajt5_Rhb4C7Kx9wFTZR6AIbP2GAfc4gXhOXWxV8tXz5LBJ_JXwgTDIfnBfqqKeYZ-GyCMmly6w2suxLwR00e4JCu1_LjDGoWA8-VPOVafhwA51t5nQ0HVzeyuEpVfqwRhsjk2ln56CY8sLd2YU12fPJiitN88t8YccLDugc8Q79OelJTgIO17d50kzXZ1twzwpimWTjgCIS90K19EXAMPLE", 5 | "server": 0 6 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 1Password 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /cmd/contrib/build/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/1Password/shell-plugins/plugins" 7 | "github.com/1Password/shell-plugins/sdk/rpc/proto" 8 | "github.com/1Password/shell-plugins/sdk/rpc/server" 9 | "github.com/1Password/shell-plugins/sdk/schema" 10 | "github.com/hashicorp/go-plugin" 11 | ) 12 | 13 | // PluginName is the name of the plugin to serve. This should be set during building using 14 | // -ldflags="-X 'main.PluginName='" 15 | var PluginName string 16 | 17 | func main() { 18 | plugin.Serve(&plugin.ServeConfig{ 19 | HandshakeConfig: plugin.HandshakeConfig{ 20 | ProtocolVersion: proto.Version, 21 | MagicCookieKey: proto.MagicCookieKey, 22 | MagicCookieValue: proto.MagicCookieValue, 23 | }, 24 | Plugins: plugin.PluginSet{ 25 | "plugin": &server.RPCPlugin{RPCPlugin: func() (schema.Plugin, error) { 26 | if PluginName == "" { 27 | return schema.Plugin{}, errors.New("plugin not set") 28 | } 29 | p, err := plugins.Get(PluginName) 30 | if err != nil { 31 | return schema.Plugin{}, err 32 | } 33 | return p, nil 34 | }}, 35 | }, 36 | }) 37 | } 38 | -------------------------------------------------------------------------------- /plugins/zendesk/zcli.go: -------------------------------------------------------------------------------- 1 | package zendesk 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ZendeskCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Zendesk CLI", 13 | Runs: []string{"zcli"}, 14 | DocsURL: sdk.URL("https://developer.zendesk.com/documentation/apps/getting-started/using-zcli/"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("profiles"), 19 | needsauth.NotWhenContainsArgs("login"), 20 | needsauth.NotWhenContainsArgs("logout"), 21 | needsauth.NotWhenContainsArgs("autocomplete"), 22 | needsauth.NotWhenContainsArgs("apps:bump"), 23 | needsauth.NotWhenContainsArgs("apps:clean"), 24 | needsauth.NotWhenContainsArgs("apps:new"), 25 | needsauth.NotWhenContainsArgs("apps:server"), 26 | ), 27 | Uses: []schema.CredentialUsage{ 28 | { 29 | Name: credname.APIToken, 30 | }, 31 | }, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /plugins/localstack/api_key_test.go: -------------------------------------------------------------------------------- 1 | package localstack 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPIKeyProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.APIKey: "SzCEXAMPLE", 16 | }, 17 | ExpectedOutput: sdk.ProvisionOutput{ 18 | Environment: map[string]string{ 19 | "LOCALSTACK_API_KEY": "SzCEXAMPLE", 20 | }, 21 | }, 22 | }, 23 | }) 24 | } 25 | 26 | func TestAPIKeyImporter(t *testing.T) { 27 | plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{ 28 | "environment": { 29 | Environment: map[string]string{ 30 | "LOCALSTACK_API_KEY": "SzCEXAMPLE", 31 | }, 32 | ExpectedCandidates: []sdk.ImportCandidate{ 33 | { 34 | Fields: map[sdk.FieldName]string{ 35 | fieldname.APIKey: "SzCEXAMPLE", 36 | }, 37 | }, 38 | }, 39 | }, 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /plugins/binance/binance_cli.go: -------------------------------------------------------------------------------- 1 | package binance 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func BinanceCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Binance CLI", 13 | Runs: []string{"binance-cli"}, 14 | DocsURL: sdk.URL("https://github.com/binance/binance-cli"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("t"), 19 | needsauth.NotWhenContainsArgs("i"), 20 | needsauth.NotWhenContainsArgs("book"), 21 | needsauth.NotWhenContainsArgs("at"), 22 | needsauth.NotWhenContainsArgs("k"), 23 | needsauth.NotWhenContainsArgs("ap"), 24 | needsauth.NotWhenContainsArgs("ticker"), 25 | needsauth.NotWhenContainsArgs("price"), 26 | needsauth.NotWhenContainsArgs("bt"), 27 | needsauth.NotWhenContainsArgs("listen"), 28 | ), 29 | Uses: []schema.CredentialUsage{ 30 | { 31 | Name: credname.APIKey, 32 | }, 33 | }, 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "locked": { 5 | "lastModified": 1756035328, 6 | "narHash": "sha256-vC7SslUBCtdT3T37ZH3PLIWYmTkSeppL5BJJByUjYCM=", 7 | "owner": "NixOS", 8 | "repo": "nixpkgs", 9 | "rev": "6b0b1559e918d4f7d1df398ee1d33aeac586d4d6", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "NixOS", 14 | "ref": "nixpkgs-unstable", 15 | "repo": "nixpkgs", 16 | "type": "github" 17 | } 18 | }, 19 | "root": { 20 | "inputs": { 21 | "nixpkgs": "nixpkgs", 22 | "systems": "systems" 23 | } 24 | }, 25 | "systems": { 26 | "locked": { 27 | "lastModified": 1681028828, 28 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 29 | "owner": "nix-systems", 30 | "repo": "default", 31 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 32 | "type": "github" 33 | }, 34 | "original": { 35 | "owner": "nix-systems", 36 | "repo": "default", 37 | "type": "github" 38 | } 39 | } 40 | }, 41 | "root": "root", 42 | "version": 7 43 | } 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/2-issue-op-cli.yml: -------------------------------------------------------------------------------- 1 | name: "💲 1Password CLI overall shell plugins functionality" 2 | description: I have an issue or feature request around using shell plugins in 1Password CLI. 3 | labels: ["op-cli"] 4 | body: 5 | - type: input 6 | id: version 7 | attributes: 8 | label: op CLI version 9 | description: "Add the output of: op --version" 10 | validations: 11 | required: true 12 | - type: textarea 13 | id: desired 14 | attributes: 15 | label: Goal or desired behavior 16 | description: What are you trying to achieve with 1Password Shell Plugins that's currently not working well? 17 | validations: 18 | required: true 19 | - type: textarea 20 | id: current 21 | attributes: 22 | label: Current behavior 23 | description: What does the status quo look like? Why is that bad? Any workarounds worth mentioning? 24 | validations: 25 | required: true 26 | - type: textarea 27 | id: logs 28 | attributes: 29 | label: Relevant log output 30 | description: If this is a bug, add any relevant log output. This will be automatically formatted into code, so no need for backticks. 31 | render: shell 32 | -------------------------------------------------------------------------------- /plugins/ohdear/api_token_test.go: -------------------------------------------------------------------------------- 1 | package ohdear 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Token: "SZ5rluwzbtMyyQFQNoeqEFbpVbTL0ItsXEXAMPLE", 16 | }, 17 | ExpectedOutput: sdk.ProvisionOutput{ 18 | Environment: map[string]string{ 19 | "OHDEAR_API_TOKEN": "SZ5rluwzbtMyyQFQNoeqEFbpVbTL0ItsXEXAMPLE", 20 | }, 21 | }, 22 | }, 23 | }) 24 | } 25 | 26 | func TestAPITokenImporter(t *testing.T) { 27 | plugintest.TestImporter(t, APIToken().Importer, map[string]plugintest.ImportCase{ 28 | "environment": { 29 | Environment: map[string]string{ 30 | "OHDEAR_API_TOKEN": "SZ5rluwzbtMyyQFQNoeqEFbpVbTL0ItsXEXAMPLE", 31 | }, 32 | ExpectedCandidates: []sdk.ImportCandidate{ 33 | { 34 | Fields: map[sdk.FieldName]string{ 35 | fieldname.Token: "SZ5rluwzbtMyyQFQNoeqEFbpVbTL0ItsXEXAMPLE", 36 | }, 37 | }, 38 | }, 39 | }, 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | name: Test and Validate 2 | on: 3 | push: 4 | paths-ignore: 5 | - '**.md' 6 | - '.github/ISSUE_TEMPLATE/**' 7 | pull_request: 8 | paths-ignore: 9 | - '**.md' 10 | - '.github/ISSUE_TEMPLATE/**' 11 | 12 | jobs: 13 | build: 14 | name: Test 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Set up Go 1.x 18 | uses: actions/setup-go@v3 19 | with: 20 | go-version: ^1.18 21 | 22 | - name: Check out code into the Go module directory 23 | uses: actions/checkout@v3 24 | 25 | - name: Test 26 | run: make test 27 | 28 | - name: Validate 29 | run: make validate 30 | golangci: 31 | name: Lint 32 | runs-on: ubuntu-latest 33 | steps: 34 | - name: "Set up Go 1.x" 35 | uses: actions/setup-go@v3 36 | with: 37 | go-version: 1.19 38 | 39 | - name: Check out code 40 | uses: actions/checkout@v3 41 | 42 | - name: Lint with golanci-lint 43 | uses: golangci/golangci-lint-action@v3 44 | with: 45 | # version of golangci-lint to use 46 | # Version should stay in sync with version used for local linting (lint job in Makefile). 47 | version: v1.50.1 48 | -------------------------------------------------------------------------------- /plugins/terraform/terraform.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | ) 8 | 9 | func TerraformCLI() schema.Executable { 10 | return schema.Executable{ 11 | Name: "Terraform CLI", 12 | Runs: []string{"terraform"}, 13 | DocsURL: sdk.URL("https://developer.hashicorp.com/terraform/cli"), 14 | NeedsAuth: needsauth.IfAll( 15 | needsauth.NotForHelpOrVersion(), 16 | needsauth.NotWithoutArgs(), 17 | ), 18 | Uses: []schema.CredentialUsage{ 19 | { 20 | Description: "Credentials to use within the Terraform project", 21 | SelectFrom: &schema.CredentialSelection{ 22 | ID: "project", 23 | IncludeAllCredentials: true, 24 | AllowMultiple: true, 25 | }, 26 | Optional: true, 27 | NeedsAuth: needsauth.IfAny( 28 | needsauth.ForCommand("refresh"), 29 | needsauth.ForCommand("init"), 30 | needsauth.ForCommand("state"), 31 | needsauth.ForCommand("plan"), 32 | needsauth.ForCommand("apply"), 33 | needsauth.ForCommand("destroy"), 34 | needsauth.ForCommand("import"), 35 | needsauth.ForCommand("test"), 36 | ), 37 | }, 38 | }, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /plugins/openai/api_key_test.go: -------------------------------------------------------------------------------- 1 | package openai 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPIKeyProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.APIKey: "sk-yEyY18xzH5IiiORdCDzstp1h2xrxCydfh9tjFveUyEXAMPLE", 16 | }, 17 | ExpectedOutput: sdk.ProvisionOutput{ 18 | Environment: map[string]string{ 19 | "OPENAI_API_KEY": "sk-yEyY18xzH5IiiORdCDzstp1h2xrxCydfh9tjFveUyEXAMPLE", 20 | }, 21 | }, 22 | }, 23 | }) 24 | } 25 | 26 | func TestAPIKeyImporter(t *testing.T) { 27 | plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{ 28 | "environment": { 29 | Environment: map[string]string{ 30 | "OPENAI_API_KEY": "sk-yEyY18xzH5IiiORdCDzstp1h2xrxCydfh9tjFveUyEXAMPLE", 31 | }, 32 | ExpectedCandidates: []sdk.ImportCandidate{ 33 | { 34 | Fields: map[sdk.FieldName]string{ 35 | fieldname.APIKey: "sk-yEyY18xzH5IiiORdCDzstp1h2xrxCydfh9tjFveUyEXAMPLE", 36 | }, 37 | }, 38 | }, 39 | }, 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /sdk/names.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | import ( 4 | "regexp" 5 | "strings" 6 | ) 7 | 8 | // FieldName represents a name of credential field. It should be title-cased. 9 | // Examples: "Password", "Token", "API Key". 10 | type FieldName string 11 | 12 | func (n FieldName) String() string { 13 | return string(n) 14 | } 15 | 16 | // CredentialName represents a name of a credential type. It should be title-cased. 17 | // Examples: "Personal Access Token", "API Key". 18 | type CredentialName string 19 | 20 | func (n CredentialName) String() string { 21 | return string(n) 22 | } 23 | 24 | func (n CredentialName) ID() CredentialTypeID { 25 | return CredentialTypeID(credentialNameToSnakeCase(n)) 26 | } 27 | 28 | func credentialNameToSnakeCase(name CredentialName) string { 29 | const underscore = "_" 30 | 31 | str := name.String() 32 | 33 | charsToReplace := regexp.MustCompile(`[-/,. ]`) 34 | str = charsToReplace.ReplaceAllLiteralString(str, underscore) 35 | 36 | multipleUnderscores := regexp.MustCompile(`_+`) 37 | str = multipleUnderscores.ReplaceAllString(str, underscore) 38 | 39 | str = strings.TrimPrefix(str, "_") 40 | str = strings.TrimSuffix(str, "_") 41 | 42 | return strings.ToLower(str) 43 | } 44 | 45 | type CredentialTypeID string 46 | 47 | func (i CredentialTypeID) String() string { 48 | return string(i) 49 | } 50 | -------------------------------------------------------------------------------- /plugins/fossa/api_key.go: -------------------------------------------------------------------------------- 1 | package fossa 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func APIKey() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.APIKey, 15 | DocsURL: sdk.URL("https://docs.fossa.com/docs/api-reference#api-tokens"), 16 | ManagementURL: sdk.URL("https://app.fossa.com/account/settings/integrations/api_tokens"), 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.APIKey, 20 | MarkdownDescription: "API Key used to authenticate to FOSSA.", 21 | Secret: true, 22 | Composition: &schema.ValueComposition{ 23 | Length: 32, 24 | Charset: schema.Charset{ 25 | Lowercase: true, 26 | Digits: true, 27 | }, 28 | }, 29 | }, 30 | }, 31 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 32 | Importer: importer.TryEnvVarPair(defaultEnvVarMapping), 33 | } 34 | } 35 | 36 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 37 | "FOSSA_API_KEY": fieldname.APIKey, 38 | } 39 | -------------------------------------------------------------------------------- /plugins/openai/api_key.go: -------------------------------------------------------------------------------- 1 | package openai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func APIKey() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.APIKey, 15 | DocsURL: sdk.URL("https://platform.openai.com/docs"), 16 | ManagementURL: sdk.URL("https://platform.openai.com/account/api-keys"), 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.APIKey, 20 | MarkdownDescription: "API Key used to authenticate to OpenAI.", 21 | Secret: true, 22 | Composition: &schema.ValueComposition{ 23 | Length: 51, 24 | Prefix: "sk-", 25 | Charset: schema.Charset{ 26 | Uppercase: true, 27 | Lowercase: true, 28 | Digits: true, 29 | }, 30 | }, 31 | }, 32 | }, 33 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 34 | Importer: importer.TryEnvVarPair(defaultEnvVarMapping)} 35 | } 36 | 37 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 38 | "OPENAI_API_KEY": fieldname.APIKey, 39 | } 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/3-issue-existing-plugin.yml: -------------------------------------------------------------------------------- 1 | name: "🗃️ Functionality around a specific plugin" 2 | description: I have an issue or feature request around a specific, existing plugin. 3 | body: 4 | - type: input 5 | id: plugin 6 | attributes: 7 | label: Platform or tool 8 | description: Which plugin does this concern? 9 | placeholder: e.g. AWS, Stripe, GitHub 10 | validations: 11 | required: true 12 | - type: textarea 13 | id: desired 14 | attributes: 15 | label: Desired or expected behavior 16 | description: What do you want to do with this plugin that is currently not possible or does not work well? 17 | validations: 18 | required: true 19 | - type: textarea 20 | id: current 21 | attributes: 22 | label: Current behavior 23 | description: What does the status quo look like? Why is that bad? Any workarounds worth mentioning? 24 | validations: 25 | required: true 26 | - type: textarea 27 | id: logs 28 | attributes: 29 | label: Relevant log output 30 | description: If this is a bug, add any relevant log output. This will be automatically formatted into code, so no need for backticks. 31 | render: shell 32 | - type: input 33 | id: version 34 | attributes: 35 | label: op CLI version 36 | description: "Add the output of: op --version" 37 | -------------------------------------------------------------------------------- /plugins/readme/rdme.go: -------------------------------------------------------------------------------- 1 | package readme 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ReadMeCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "ReadMe CLI", 13 | Runs: []string{"rdme"}, 14 | DocsURL: sdk.URL("https://docs.readme.com/main/docs/rdme"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | 18 | needsauth.NotWhenContainsArgs("--key"), 19 | 20 | needsauth.IfAny( 21 | needsauth.ForCommand("openapi"), 22 | 23 | needsauth.ForCommand("docs"), 24 | needsauth.ForCommand("docs:prune"), 25 | needsauth.ForCommand("guides"), 26 | needsauth.ForCommand("guides:prune"), 27 | 28 | needsauth.ForCommand("changelogs"), 29 | needsauth.ForCommand("custompages"), 30 | 31 | needsauth.ForCommand("versions"), 32 | needsauth.ForCommand("versions:create"), 33 | needsauth.ForCommand("versions:delete"), 34 | needsauth.ForCommand("versions:update"), 35 | 36 | needsauth.ForCommand("categories"), 37 | needsauth.ForCommand("categories:create"), 38 | ), 39 | ), 40 | Uses: []schema.CredentialUsage{ 41 | { 42 | Name: credname.APIKey, 43 | }, 44 | }, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /plugins/ohdear/api_token.go: -------------------------------------------------------------------------------- 1 | package ohdear 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func APIToken() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.APIToken, 15 | DocsURL: sdk.URL("https://ohdear.app/docs/integrations/the-oh-dear-api#get-your-api-token"), 16 | ManagementURL: sdk.URL("https://ohdear.app/user/api-tokens"), 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.Token, 20 | MarkdownDescription: "Token used to authenticate to Oh Dear.", 21 | Secret: true, 22 | Composition: &schema.ValueComposition{ 23 | Length: 40, 24 | Charset: schema.Charset{ 25 | Uppercase: true, 26 | Lowercase: true, 27 | Digits: true, 28 | }, 29 | }, 30 | }, 31 | }, 32 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 33 | Importer: importer.TryAll( 34 | importer.TryEnvVarPair(defaultEnvVarMapping), 35 | )} 36 | } 37 | 38 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 39 | "OHDEAR_API_TOKEN": fieldname.Token, 40 | } 41 | -------------------------------------------------------------------------------- /plugins/localstack/api_key.go: -------------------------------------------------------------------------------- 1 | package localstack 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func APIKey() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.APIKey, 15 | DocsURL: sdk.URL("https://docs.localstack.cloud/getting-started/api-key/"), 16 | ManagementURL: sdk.URL("https://app.localstack.cloud/account/apikeys"), 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.APIKey, 20 | MarkdownDescription: "API Key used to authenticate to LocalStack.", 21 | Secret: true, 22 | Composition: &schema.ValueComposition{ 23 | Length: 10, 24 | Charset: schema.Charset{ 25 | Uppercase: true, 26 | Lowercase: true, 27 | Digits: true, 28 | }, 29 | }, 30 | }, 31 | }, 32 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 33 | Importer: importer.TryAll( 34 | importer.TryEnvVarPair(defaultEnvVarMapping), 35 | )} 36 | } 37 | 38 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 39 | "LOCALSTACK_API_KEY": fieldname.APIKey, 40 | } 41 | -------------------------------------------------------------------------------- /plugins/todoist/api_token_test.go: -------------------------------------------------------------------------------- 1 | package todoist 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "config file": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Token: "dbq9y65uguqrk4ognfhdiwcc0zx34z20pexample", 16 | }, 17 | CommandLine: []string{"todoist"}, 18 | ExpectedOutput: sdk.ProvisionOutput{ 19 | CommandLine: []string{"todoist"}, 20 | Files: map[string]sdk.OutputFile{ 21 | "~/.config/todoist/config.json": { 22 | Contents: []byte(plugintest.LoadFixture(t, "config.json")), 23 | }, 24 | }, 25 | }, 26 | }, 27 | }) 28 | } 29 | 30 | func TestAPITokenImporter(t *testing.T) { 31 | plugintest.TestImporter(t, APIToken().Importer, map[string]plugintest.ImportCase{ 32 | "config file": { 33 | Files: map[string]string{ 34 | "~/.config/todoist/config.json": plugintest.LoadFixture(t, "config.json"), 35 | }, 36 | ExpectedCandidates: []sdk.ImportCandidate{ 37 | { 38 | Fields: map[sdk.FieldName]string{ 39 | fieldname.Token: "dbq9y65uguqrk4ognfhdiwcc0zx34z20pexample", 40 | }, 41 | }, 42 | }, 43 | }, 44 | }) 45 | } 46 | -------------------------------------------------------------------------------- /plugins/ngrok/ngrok.go: -------------------------------------------------------------------------------- 1 | package ngrok 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func ngrokCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "ngrok CLI", 13 | Runs: []string{"ngrok"}, 14 | DocsURL: sdk.URL("https://ngrok.com/docs/ngrok-agent/ngrok"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("config"), // skip 1Password authentication for "ngrok config" and its subcommands 19 | needsauth.NotWhenContainsArgs("update"), // skip 1Password authentication for "ngrok update" and "ngrok update --channel=beta" 20 | needsauth.NotWhenContainsArgs("completion"), // skip 1Password authentication for "ngrok completion" 21 | needsauth.NotWhenContainsArgs("credits"), // skip 1Password authentication for "ngrok credits" 22 | needsauth.NotWhenContainsArgs("service"), // skip 1Password authentication for "ngrok service" subcommands because that setup involves defining/knowing in advance the config file path, which isn't something we can handle with 1Password Shell Plugins. 23 | ), 24 | Uses: []schema.CredentialUsage{ 25 | { 26 | Name: credname.Credentials, 27 | }, 28 | }, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /plugins/influxdb/database_credentials.go: -------------------------------------------------------------------------------- 1 | package influxdb 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func DatabaseCredentials() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.DatabaseCredentials, 15 | DocsURL: sdk.URL("https://docs.influxdata.com/influxdb/cloud/reference/cli/influx/config/"), 16 | Fields: []schema.CredentialField{ 17 | { 18 | Name: fieldname.Host, 19 | MarkdownDescription: "InfluxDB host name", 20 | }, 21 | { 22 | Name: fieldname.Organization, 23 | MarkdownDescription: "InfluxDB Organization name", 24 | }, 25 | { 26 | Name: fieldname.AccessToken, 27 | MarkdownDescription: "InfluxDB Token value", 28 | Secret: true, 29 | }, 30 | }, 31 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 32 | Importer: importer.TryEnvVarPair(defaultEnvVarMapping), 33 | } 34 | } 35 | 36 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 37 | "INFLUX_HOST": fieldname.Host, 38 | "INFLUX_ORG": fieldname.Organization, 39 | "INFLUX_TOKEN": fieldname.AccessToken, 40 | } 41 | -------------------------------------------------------------------------------- /sdk/provision/env_var_provisioner.go: -------------------------------------------------------------------------------- 1 | package provision 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "strings" 7 | 8 | "github.com/1Password/shell-plugins/sdk" 9 | ) 10 | 11 | // EnvVarProvisioner provisions secrets as environment variables. 12 | type EnvVarProvisioner struct { 13 | sdk.Provisioner 14 | 15 | Schema map[string]sdk.FieldName 16 | } 17 | 18 | // EnvVars creates an EnvVarProvisioner that provisions secrets as environment variables, based 19 | // on the specified schema of field name and environment variable name. 20 | func EnvVars(schema map[string]sdk.FieldName) sdk.Provisioner { 21 | return EnvVarProvisioner{ 22 | Schema: schema, 23 | } 24 | } 25 | 26 | func (p EnvVarProvisioner) Provision(ctx context.Context, in sdk.ProvisionInput, out *sdk.ProvisionOutput) { 27 | for envVarName, fieldName := range p.Schema { 28 | if value, ok := in.ItemFields[fieldName]; ok { 29 | out.AddEnvVar(envVarName, value) 30 | } 31 | } 32 | } 33 | 34 | func (p EnvVarProvisioner) Deprovision(ctx context.Context, in sdk.DeprovisionInput, out *sdk.DeprovisionOutput) { 35 | // Nothing to do here: environment variables get wiped automatically when the process exits. 36 | } 37 | 38 | func (p EnvVarProvisioner) Description() string { 39 | var envVarNames []string 40 | for envVarName := range p.Schema { 41 | envVarNames = append(envVarNames, envVarName) 42 | } 43 | 44 | return fmt.Sprintf("Provision environment variables: %s", strings.Join(envVarNames, ", ")) 45 | } 46 | -------------------------------------------------------------------------------- /plugins/atlas/apikey_test.go: -------------------------------------------------------------------------------- 1 | package atlas 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestCredentialsProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.PublicKey: "eexample", 16 | fieldname.PrivateKey: "qohcbhiu-26ag-wpwf-maqn-cw5xlexample", 17 | }, 18 | ExpectedOutput: sdk.ProvisionOutput{ 19 | Environment: map[string]string{ 20 | "MONGODB_ATLAS_PUBLIC_API_KEY": "eexample", 21 | "MONGODB_ATLAS_PRIVATE_API_KEY": "qohcbhiu-26ag-wpwf-maqn-cw5xlexample", 22 | }, 23 | }, 24 | }, 25 | }) 26 | } 27 | 28 | func TestCredentialsImporter(t *testing.T) { 29 | plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{ 30 | "environment": { 31 | Environment: map[string]string{ 32 | "MONGODB_ATLAS_PUBLIC_API_KEY": "eexample", 33 | "MONGODB_ATLAS_PRIVATE_API_KEY": "qohcbhiu-26ag-wpwf-maqn-cw5xlexample", 34 | }, 35 | ExpectedCandidates: []sdk.ImportCandidate{ 36 | { 37 | Fields: map[sdk.FieldName]string{ 38 | fieldname.PublicKey: "eexample", 39 | fieldname.PrivateKey: "qohcbhiu-26ag-wpwf-maqn-cw5xlexample", 40 | }, 41 | }, 42 | }, 43 | }, 44 | }) 45 | } 46 | -------------------------------------------------------------------------------- /plugins/stripe/test-fixtures/config.toml: -------------------------------------------------------------------------------- 1 | color = '' 2 | project-name = 'default' 3 | 4 | [default] 5 | account_id = 'demo_account' 6 | device_name = 'RedmiNote4-Liya.localdomain' 7 | live_mode_api_key = 'sk_TEm8TYekzqaEKmSIDRb4PXJQAoq94iL6PZx4C1RQlr1Ls5kn67RVRJjhBfmejEX8OS4T7GxCWBnqBuIG20SzdEwopINxyEL05EXAMPLE' 8 | live_mode_key_expires_at = '2023-02-28' 9 | live_mode_pub_key = 'sk_KvcVqtvQCMTqOAxc1I7a52UBdHAsftBwywZkY6N7HOoYWyR9auvU27iBFp9Dd6URanVRXOfVYw3QZqIr9FmOkKX032675zLZwEXAMPLE' 10 | test_mode_api_key = 'sk_uKVoEC2LqU1aXSbKM1ptxFB3QxWiSTMTnbr0CGvkEBMFOs2vetsHc148WMhtrVRAAsP4fcRd35Fz7ykqbhLoa04ZoA7AcRKvUEXAMPLE' 11 | test_mode_key_expires_at = '2023-02-28' 12 | test_mode_pub_key = 'sk_BSszinJYHnVbzn49LL6XvSoB0HYxvAlo8iPi3MxEgBSwXE7vz1lk0gTACYw7lIL2J96YYewG8VoGzO5ZJ0IZQJu43oY48k695EXAMPLE' 13 | 14 | [custom] 15 | account_id = 'demo_account' 16 | device_name = 'MacBookPro' 17 | live_mode_api_key = 'sk_UYmt7xpmCZhXgJQypQer6twgdE9pxJsdUWeHcwcce9PKQQPIw1uEMvnWc03GxNOl96mX98Jz9a5Xf9urKYG1Ni2LDk425S2LWEXAMPLE' 18 | live_mode_key_expires_at = '2023-02-28' 19 | live_mode_pub_key = 'sk_fH7FdMNzaz6BWO6PBLlY0SWUa82C4Tjhdcbob8wthMDS9V2e2PKEAATTirQy7QHJp4SBNNWjgJpfaIXDOvm4utcYqmc8G3cjPEXAMPLE' 20 | test_mode_api_key = 'sk_9Q9YiSK3uWDqSiNYLakhI6s3f6uHQekczqqdfpRsOI0Zwc6ozOMNAzNfVSNlhnA6IipOakrnF8gdhJ5sC97acFy9d0UbhKe2WEXAMPLE' 21 | test_mode_key_expires_at = '2023-02-28' 22 | test_mode_pub_key = 'sk_uvEYZtPFy9P43SeSNjUwbiQ1hafj5AaDn5IQBvIoV6LvTJgCK6x0NxakJtGspsc3Ir6gQEBgJ5ve6BYePllRHMRLsZ62DjryFEXAMPLE' -------------------------------------------------------------------------------- /plugins/pulumi/test-fixtures/credentials.json: -------------------------------------------------------------------------------- 1 | { 2 | "current": "https://api.pulumi.com", 3 | "accessTokens": { 4 | "http://localhost:8080": "pul-8s9b3qf8rx7x8x8pn03ibkemilm1zfs10example", 5 | "https://api.pulumi.com": "pul-8s9b3qf8rx7x8x8pn03ibkemilm1zfs10example", 6 | "s3://pulumi-service-checkpoints-058607598222-production": "", 7 | "s3://pulumi-service-checkpoints-372027080554-production": "" 8 | }, 9 | "accounts": { 10 | "http://localhost:8080": { 11 | "accessToken": "pul-8s9b3qf8rx7x8x8pn03ibkemilm1zfs10example", 12 | "username": "unknownuser", 13 | "organizations": [ 14 | "unknownuser", 15 | "other-test-org" 16 | ], 17 | "lastValidatedAt": "2023-03-10T10:20:46.064887-08:00" 18 | }, 19 | "https://api.pulumi.com": { 20 | "accessToken": "pul-8s9b3qf8rx7x8x8pn03ibkemilm1zfs10example", 21 | "username": "unknown-corp-user", 22 | "organizations": [ 23 | "test-corp", 24 | "test_org" 25 | ], 26 | "lastValidatedAt": "2023-03-10T10:30:23.836244-08:00" 27 | }, 28 | "s3://pulumi-checkpoints-372027080672-production": { 29 | "lastValidatedAt": "0001-01-01T00:00:00Z" 30 | }, 31 | "s3://pulumi-checkpoints-372027080672-staging": { 32 | "lastValidatedAt": "0001-01-01T00:00:00Z" 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /sdk/importer/helpers.go: -------------------------------------------------------------------------------- 1 | package importer 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | ) 8 | 9 | func TryAll(importers ...sdk.Importer) sdk.Importer { 10 | return func(ctx context.Context, in sdk.ImportInput, out *sdk.ImportOutput) { 11 | for _, imp := range importers { 12 | imp(ctx, in, out) 13 | } 14 | } 15 | } 16 | 17 | func MacOnly(importers ...sdk.Importer) sdk.Importer { 18 | return func(ctx context.Context, in sdk.ImportInput, out *sdk.ImportOutput) { 19 | if in.OS == "darwin" { 20 | for _, imp := range importers { 21 | imp(ctx, in, out) 22 | } 23 | } 24 | } 25 | } 26 | 27 | func LinuxOnly(importers ...sdk.Importer) sdk.Importer { 28 | return func(ctx context.Context, in sdk.ImportInput, out *sdk.ImportOutput) { 29 | if in.OS == "linux" { 30 | for _, imp := range importers { 31 | imp(ctx, in, out) 32 | } 33 | } 34 | } 35 | } 36 | 37 | const maxNameHintLength = 24 38 | 39 | // SanitizeNameHint can be used to sanitize the name hint before passing it to the import candidate to 40 | // improve the suggested item title. 41 | func SanitizeNameHint(nameHint string) string { 42 | // Omit the name hint if it's "default", which doesn't add much value in the item name 43 | if nameHint == "default" { 44 | return "" 45 | } 46 | 47 | // Avoid name hints that are too long 48 | if len(nameHint) > maxNameHintLength { 49 | nameHint = nameHint[:maxNameHintLength-1] + "…" 50 | } 51 | 52 | return nameHint 53 | } 54 | -------------------------------------------------------------------------------- /plugins/homebrew/personal_access_token.go: -------------------------------------------------------------------------------- 1 | package homebrew 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func PersonalAccessToken() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.PersonalAccessToken, 15 | DocsURL: sdk.URL("https://docs.brew.sh/Manpage#environment"), 16 | ManagementURL: sdk.URL("https://github.com/settings/tokens/new?scopes=gist,repo,workflow&description=Homebrew"), 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.Token, 20 | MarkdownDescription: "Token used to authenticate to GitHub with Homebrew.", 21 | Secret: true, 22 | Composition: &schema.ValueComposition{ 23 | Length: 40, 24 | Prefix: "ghp_", 25 | Charset: schema.Charset{ 26 | Uppercase: true, 27 | Lowercase: true, 28 | Digits: true, 29 | }, 30 | }, 31 | }, 32 | }, 33 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 34 | Importer: importer.TryAll( 35 | importer.TryEnvVarPair(defaultEnvVarMapping), 36 | )} 37 | } 38 | 39 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 40 | "HOMEBREW_GITHUB_API_TOKEN": fieldname.Token, 41 | } 42 | -------------------------------------------------------------------------------- /plugins/sourcegraph/access_token_test.go: -------------------------------------------------------------------------------- 1 | package sourcegraph 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAccessTokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, AccessToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Endpoint: "https://sourcegraph.com", 16 | fieldname.Token: "bqrv8bpqtplf7xv5lkk6oxfldtttmhzx4example", 17 | }, 18 | ExpectedOutput: sdk.ProvisionOutput{ 19 | Environment: map[string]string{ 20 | "SRC_ENDPOINT": "https://sourcegraph.com", 21 | "SRC_ACCESS_TOKEN": "bqrv8bpqtplf7xv5lkk6oxfldtttmhzx4example", 22 | }, 23 | }, 24 | }, 25 | }) 26 | } 27 | 28 | func TestAccessTokenImporter(t *testing.T) { 29 | plugintest.TestImporter(t, AccessToken().Importer, map[string]plugintest.ImportCase{ 30 | "environment": { 31 | Environment: map[string]string{ 32 | "SRC_ENDPOINT": "https://sourcegraph.com", 33 | "SRC_ACCESS_TOKEN": "bqrv8bpqtplf7xv5lkk6oxfldtttmhzx4example", 34 | }, 35 | ExpectedCandidates: []sdk.ImportCandidate{ 36 | { 37 | Fields: map[sdk.FieldName]string{ 38 | fieldname.Endpoint: "https://sourcegraph.com", 39 | fieldname.Token: "bqrv8bpqtplf7xv5lkk6oxfldtttmhzx4example", 40 | }, 41 | }, 42 | }, 43 | }, 44 | }) 45 | } 46 | -------------------------------------------------------------------------------- /plugins/zapier/deploy_key_test.go: -------------------------------------------------------------------------------- 1 | package zapier 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestDeployKeyProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, DeployKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "environment": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Key: "g22y9yajfqqcogilnrnm5lxv6example", 16 | }, 17 | ExpectedOutput: sdk.ProvisionOutput{ 18 | Environment: map[string]string{ 19 | "ZAPIER_DEPLOY_KEY": "g22y9yajfqqcogilnrnm5lxv6example", 20 | }, 21 | }, 22 | }, 23 | }) 24 | } 25 | 26 | func TestDeployKeyImporter(t *testing.T) { 27 | plugintest.TestImporter(t, DeployKey().Importer, map[string]plugintest.ImportCase{ 28 | "environment": { 29 | Environment: map[string]string{ 30 | "ZAPIER_DEPLOY_KEY": "g22y9yajfqqcogilnrnm5lxv6example", 31 | }, 32 | ExpectedCandidates: []sdk.ImportCandidate{ 33 | { 34 | Fields: map[sdk.FieldName]string{ 35 | fieldname.Key: "g22y9yajfqqcogilnrnm5lxv6example", 36 | }, 37 | }, 38 | }, 39 | }, 40 | "config file": { 41 | Files: map[string]string{ 42 | "~/.zapierrc": plugintest.LoadFixture(t, ".zapierrc"), 43 | }, 44 | ExpectedCandidates: []sdk.ImportCandidate{ 45 | { 46 | Fields: map[sdk.FieldName]string{ 47 | fieldname.Key: "g22y9yajfqqcogilnrnm5lxv6example", 48 | }, 49 | }, 50 | }, 51 | }, 52 | }) 53 | } 54 | -------------------------------------------------------------------------------- /plugins/cargo/api_token_test.go: -------------------------------------------------------------------------------- 1 | package cargo 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Token: "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE", 16 | }, 17 | ExpectedOutput: sdk.ProvisionOutput{ 18 | Environment: map[string]string{ 19 | "CARGO_REGISTRY_TOKEN": "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE", 20 | }, 21 | }, 22 | }, 23 | }) 24 | } 25 | 26 | func TestAPITokenImporter(t *testing.T) { 27 | plugintest.TestImporter(t, APIToken().Importer, map[string]plugintest.ImportCase{ 28 | "environment": { 29 | Environment: map[string]string{ 30 | "CARGO_REGISTRY_TOKEN": "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE", 31 | }, 32 | ExpectedCandidates: []sdk.ImportCandidate{ 33 | { 34 | Fields: map[sdk.FieldName]string{ 35 | fieldname.Token: "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE", 36 | }, 37 | }, 38 | }, 39 | }, 40 | "config file": { 41 | Files: map[string]string{ 42 | "~/.cargo/credentials.toml": plugintest.LoadFixture(t, "credentials.toml"), 43 | }, 44 | ExpectedCandidates: []sdk.ImportCandidate{ 45 | { 46 | Fields: map[sdk.FieldName]string{ 47 | fieldname.Token: "9xAQsMIO2UubpsgD2eUOKqXEXAMPLE", 48 | }, 49 | }, 50 | }, 51 | }, 52 | }) 53 | } 54 | -------------------------------------------------------------------------------- /plugins/snyk/api_token_test.go: -------------------------------------------------------------------------------- 1 | package snyk 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenImporter(t *testing.T) { 12 | plugintest.TestImporter(t, APIToken().Importer, map[string]plugintest.ImportCase{ 13 | "default": { 14 | Environment: map[string]string{ 15 | "SNYK_TOKEN": "etacgrrwj86t255ckguircl3kw3ftexample", 16 | }, 17 | ExpectedCandidates: []sdk.ImportCandidate{ 18 | { 19 | Fields: map[sdk.FieldName]string{ 20 | fieldname.Token: "etacgrrwj86t255ckguircl3kw3ftexample", 21 | }, 22 | }, 23 | }, 24 | }, 25 | "config file default path": { 26 | Files: map[string]string{ 27 | "~/.config/configstore/snyk.json": plugintest.LoadFixture(t, "snyk.json"), 28 | }, 29 | ExpectedCandidates: []sdk.ImportCandidate{ 30 | { 31 | Fields: map[sdk.FieldName]string{ 32 | fieldname.Token: "38j9ss3m5m3c44vi916z6p33m21xgexample", 33 | }, 34 | }, 35 | }, 36 | }, 37 | }) 38 | } 39 | 40 | func TestAPITokenProvisioner(t *testing.T) { 41 | plugintest.TestProvisioner(t, APIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 42 | "default": { 43 | ItemFields: map[sdk.FieldName]string{ 44 | fieldname.Token: "etacgrrwj86t255ckguircl3kw3ftexample", 45 | }, 46 | ExpectedOutput: sdk.ProvisionOutput{ 47 | Environment: map[string]string{ 48 | "SNYK_TOKEN": "etacgrrwj86t255ckguircl3kw3ftexample", 49 | }, 50 | }, 51 | }, 52 | }) 53 | } 54 | -------------------------------------------------------------------------------- /plugins/huggingface/user_access_token_test.go: -------------------------------------------------------------------------------- 1 | package huggingface 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner( 13 | t, UserAccessToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 14 | "default": { 15 | ItemFields: map[sdk.FieldName]string{ 16 | fieldname.UserAccessToken: "hf_yVvZeburdKtnwkVCWPXimmNwaFuEXAMPLE", 17 | fieldname.Endpoint: "https://huggingface.co", 18 | fieldname.APIUrl: "https://api-inference.huggingface.com", 19 | }, 20 | ExpectedOutput: sdk.ProvisionOutput{ 21 | Environment: map[string]string{ 22 | "HUGGING_FACE_HUB_TOKEN": "hf_yVvZeburdKtnwkVCWPXimmNwaFuEXAMPLE", 23 | "HF_ENDPOINT": "https://huggingface.co", 24 | "HF_INFERENCE_ENDPOINT": "https://api-inference.huggingface.com", 25 | }, 26 | }, 27 | }, 28 | }) 29 | } 30 | 31 | func TestAPITokenImporter(t *testing.T) { 32 | plugintest.TestImporter( 33 | t, UserAccessToken().Importer, map[string]plugintest.ImportCase{ 34 | "config file (macOS)": { 35 | Files: map[string]string{ 36 | "~/.cache/huggingface/token": plugintest.LoadFixture(t, "token"), 37 | }, 38 | ExpectedCandidates: []sdk.ImportCandidate{ 39 | { 40 | Fields: map[sdk.FieldName]string{ 41 | fieldname.UserAccessToken: "hf_yVvZeburdKtnwkVCWPXimmNwaFuEXAMPLE\n", 42 | }, 43 | }, 44 | }, 45 | }, 46 | }, 47 | ) 48 | } 49 | -------------------------------------------------------------------------------- /plugins/flyctl/access_token_test.go: -------------------------------------------------------------------------------- 1 | package flyctl 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAccessTokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, AccessToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Token: "DtP7HoOPOBHMP6bE5tx3nguB5r2zPpSbg9hlEXAMPLE", 16 | }, 17 | ExpectedOutput: sdk.ProvisionOutput{ 18 | Environment: map[string]string{ 19 | "FLY_ACCESS_TOKEN": "DtP7HoOPOBHMP6bE5tx3nguB5r2zPpSbg9hlEXAMPLE", 20 | }, 21 | }, 22 | }, 23 | }) 24 | } 25 | 26 | func TestAccessTokenImporter(t *testing.T) { 27 | plugintest.TestImporter(t, AccessToken().Importer, map[string]plugintest.ImportCase{ 28 | "environment": { 29 | Environment: map[string]string{ 30 | "FLY_ACCESS_TOKEN": "DtP7HoOPOBHMP6bE5tx3nguB5r2zPpSbg9hlEXAMPLE", 31 | }, 32 | ExpectedCandidates: []sdk.ImportCandidate{ 33 | { 34 | Fields: map[sdk.FieldName]string{ 35 | fieldname.Token: "DtP7HoOPOBHMP6bE5tx3nguB5r2zPpSbg9hlEXAMPLE", 36 | }, 37 | }, 38 | }, 39 | }, 40 | "config file": { 41 | Files: map[string]string{ 42 | "~/.fly/config.yml": plugintest.LoadFixture(t, "config.yml"), 43 | }, 44 | ExpectedCandidates: []sdk.ImportCandidate{ 45 | { 46 | Fields: map[sdk.FieldName]string{ 47 | fieldname.Token: "DtP7HoOPOBHMP6bE5tx3nguB5r2zPpSbg9hlEXAMPLE", 48 | }, 49 | }, 50 | }, 51 | }, 52 | }) 53 | } 54 | -------------------------------------------------------------------------------- /cmd/contrib/scripts/config_dir_getter.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | 8 | "github.com/mitchellh/go-homedir" 9 | ) 10 | 11 | // Retrieve the config directory to read or write to 12 | func main() { 13 | // This logic is based on the order of precedence outlined in the CLI documentation: 14 | // https://developer.1password.com/docs/cli/config-directories 15 | 16 | // If OP_CONFIG_DIR is set, use it immediately 17 | if opConfigDir, _ := os.LookupEnv("OP_CONFIG_DIR"); opConfigDir != "" { 18 | fmt.Print(opConfigDir) 19 | return 20 | } 21 | 22 | xdgConfigHome, _ := os.LookupEnv("XDG_CONFIG_HOME") 23 | home, _ := homedir.Dir() 24 | configDirPaths := []string{} 25 | if home != "" { 26 | // Legacy home 27 | configDirPaths = append(configDirPaths, filepath.Join(home, ".op")) 28 | } 29 | if xdgConfigHome != "" { 30 | // Legacy xdg 31 | configDirPaths = append(configDirPaths, filepath.Join(xdgConfigHome, ".op")) 32 | } 33 | if home != "" { 34 | // New home 35 | configDirPaths = append(configDirPaths, filepath.Join(home, ".config", "op")) 36 | } 37 | if xdgConfigHome != "" { 38 | // New xdg 39 | configDirPaths = append(configDirPaths, filepath.Join(xdgConfigHome, "op")) 40 | } 41 | 42 | for _, configDir := range configDirPaths { 43 | fileInfo, err := os.Stat(configDir) 44 | if err == nil && fileInfo.IsDir() { 45 | fmt.Print(configDir) 46 | return 47 | } 48 | } 49 | 50 | // None of those directories exist and OP_CONFIG_DIR is not set 51 | // Default to the last entry in the list 52 | if len(configDirPaths) > 0 { 53 | fmt.Print(configDirPaths[len(configDirPaths)-1]) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /plugins/zendesk/api_token_test.go: -------------------------------------------------------------------------------- 1 | package zendesk 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Subdomain: "subdomain", 16 | fieldname.Email: "wendy@appleseed.com", 17 | fieldname.Token: "TPPmg1SEWr4fDGQhaUHsxETCUrBEIJKm0EXAMPLE", 18 | }, 19 | ExpectedOutput: sdk.ProvisionOutput{ 20 | Environment: map[string]string{ 21 | "ZENDESK_SUBDOMAIN": "subdomain", 22 | "ZENDESK_EMAIL": "wendy@appleseed.com", 23 | "ZENDESK_API_TOKEN": "TPPmg1SEWr4fDGQhaUHsxETCUrBEIJKm0EXAMPLE", 24 | }, 25 | }, 26 | }, 27 | }) 28 | } 29 | 30 | func TestAPITokenImporter(t *testing.T) { 31 | plugintest.TestImporter(t, APIToken().Importer, map[string]plugintest.ImportCase{ 32 | "environment": { 33 | Environment: map[string]string{ 34 | "ZENDESK_SUBDOMAIN": "subdomain", 35 | "ZENDESK_EMAIL": "wendy@appleseed.com", 36 | "ZENDESK_API_TOKEN": "TPPmg1SEWr4fDGQhaUHsxETCUrBEIJKm0EXAMPLE", 37 | }, 38 | ExpectedCandidates: []sdk.ImportCandidate{ 39 | { 40 | Fields: map[sdk.FieldName]string{ 41 | fieldname.Subdomain: "subdomain", 42 | fieldname.Email: "wendy@appleseed.com", 43 | fieldname.Token: "TPPmg1SEWr4fDGQhaUHsxETCUrBEIJKm0EXAMPLE", 44 | }, 45 | }, 46 | }, 47 | }, 48 | }) 49 | } 50 | -------------------------------------------------------------------------------- /plugins/axiom/personal_access_token_test.go: -------------------------------------------------------------------------------- 1 | package axiom 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestPersonalAccessTokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, PersonalAccessToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Token: "xapt-wovexreez0qf7zvkn935na41cudk2example", 16 | fieldname.Organization: "example", 17 | fieldname.Deployment: "cloud", 18 | }, 19 | ExpectedOutput: sdk.ProvisionOutput{ 20 | Environment: map[string]string{ 21 | "AXIOM_TOKEN": "xapt-wovexreez0qf7zvkn935na41cudk2example", 22 | "AXIOM_ORG_ID": "example", 23 | "AXIOM_DEPLOYMENT": "cloud", 24 | }, 25 | }, 26 | }, 27 | }) 28 | } 29 | 30 | func TestPersonalAccessTokenImporter(t *testing.T) { 31 | plugintest.TestImporter(t, PersonalAccessToken().Importer, map[string]plugintest.ImportCase{ 32 | "environment": { 33 | Environment: map[string]string{ 34 | "AXIOM_TOKEN": "xapt-wovexreez0qf7zvkn935na41cudk2example", 35 | "AXIOM_ORG_ID": "example", 36 | "AXIOM_DEPLOYMENT": "cloud", 37 | }, 38 | ExpectedCandidates: []sdk.ImportCandidate{ 39 | { 40 | Fields: map[sdk.FieldName]string{ 41 | fieldname.Token: "xapt-wovexreez0qf7zvkn935na41cudk2example", 42 | fieldname.Organization: "example", 43 | fieldname.Deployment: "cloud", 44 | }, 45 | }, 46 | }, 47 | }, 48 | }) 49 | } 50 | -------------------------------------------------------------------------------- /plugins/vault/auth_token_test.go: -------------------------------------------------------------------------------- 1 | package vault 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAuthTokenImporter(t *testing.T) { 12 | plugintest.TestImporter(t, AuthToken().Importer, map[string]plugintest.ImportCase{ 13 | "environment": { 14 | Environment: map[string]string{ 15 | "VAULT_TOKEN": "jWIJtxke7DkUJ2A9FjJVU9YfmZRF3p04FbsEXAMPLE", 16 | "VAULT_ADDR": "https://vault.acme.com", 17 | "VAULT_NAMESPACE": "default", 18 | }, 19 | ExpectedCandidates: []sdk.ImportCandidate{ 20 | { 21 | Fields: map[sdk.FieldName]string{ 22 | fieldname.Token: "jWIJtxke7DkUJ2A9FjJVU9YfmZRF3p04FbsEXAMPLE", 23 | fieldname.Address: "https://vault.acme.com", 24 | fieldname.Namespace: "default", 25 | }, 26 | }, 27 | }, 28 | }, 29 | }) 30 | } 31 | 32 | func TestAuthTokenProvisioner(t *testing.T) { 33 | plugintest.TestProvisioner(t, AuthToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 34 | "default": { 35 | ItemFields: map[sdk.FieldName]string{ 36 | fieldname.Token: "jWIJtxke7DkUJ2A9FjJVU9YfmZRF3p04FbsEXAMPLE", 37 | fieldname.Address: "https://vault.acme.com", 38 | fieldname.Namespace: "default", 39 | }, 40 | ExpectedOutput: sdk.ProvisionOutput{ 41 | Environment: map[string]string{ 42 | "VAULT_TOKEN": "jWIJtxke7DkUJ2A9FjJVU9YfmZRF3p04FbsEXAMPLE", 43 | "VAULT_ADDR": "https://vault.acme.com", 44 | "VAULT_NAMESPACE": "default", 45 | }, 46 | }, 47 | }, 48 | }) 49 | } 50 | -------------------------------------------------------------------------------- /plugins/circleci/personal_api_token_test.go: -------------------------------------------------------------------------------- 1 | package circleci 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestPersonalAPITokenImporter(t *testing.T) { 12 | plugintest.TestImporter(t, PersonalAPIToken().Importer, map[string]plugintest.ImportCase{ 13 | "environment": { 14 | Environment: map[string]string{ 15 | "CIRCLECI_CLI_TOKEN": "1evr6rbndnaphymaljwpulrlvws7oolrmexample", 16 | }, 17 | ExpectedCandidates: []sdk.ImportCandidate{ 18 | { 19 | Fields: map[sdk.FieldName]string{ 20 | fieldname.Token: "1evr6rbndnaphymaljwpulrlvws7oolrmexample", 21 | }, 22 | }, 23 | }, 24 | }, 25 | "CircleCI config file": { 26 | Files: map[string]string{ 27 | "~/.circleci/cli.yml": plugintest.LoadFixture(t, "cli.yaml"), 28 | }, 29 | ExpectedCandidates: []sdk.ImportCandidate{ 30 | { 31 | Fields: map[sdk.FieldName]string{ 32 | fieldname.Token: "1evr6rbndnaphymaljwpulrlvws7oolrmexample", 33 | }, 34 | }, 35 | }, 36 | }, 37 | }) 38 | } 39 | 40 | func TestPersonalAPITokenProvisioner(t *testing.T) { 41 | plugintest.TestProvisioner(t, PersonalAPIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 42 | "default": { 43 | ItemFields: map[sdk.FieldName]string{ 44 | fieldname.Token: "1evr6rbndnaphymaljwpulrlvws7oolrmexample", 45 | }, 46 | ExpectedOutput: sdk.ProvisionOutput{ 47 | Environment: map[string]string{ 48 | "CIRCLECI_CLI_TOKEN": "1evr6rbndnaphymaljwpulrlvws7oolrmexample", 49 | }, 50 | }, 51 | }, 52 | }) 53 | } 54 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | config_dir := $(shell go run cmd/contrib/scripts/config_dir_getter.go) 2 | plugins_dir := ${config_dir}/plugins/local 3 | 4 | .PHONY: new-plugin registry %/example-secrets %/validate %/build test 5 | 6 | beta-notice: 7 | @echo "# BETA NOTICE: The plugin ecosystem is in beta and is subject to change." 8 | @echo "# You may have to update or recompile your local builds every now and then to keep them" 9 | @echo "# compatible with the 1Password CLI updates." 10 | @echo 11 | 12 | new-plugin: beta-notice 13 | go run cmd/contrib/main.go $@ 14 | 15 | registry: 16 | @rm -f plugins/plugins.go 17 | @go run cmd/contrib/main.go $@ 18 | 19 | %/example-secrets: registry 20 | go run cmd/contrib/main.go $@ 21 | 22 | %/validate: registry beta-notice 23 | go run cmd/contrib/main.go $@ 24 | 25 | validate: registry 26 | go run cmd/contrib/main.go $@ 27 | 28 | registry.json: registry 29 | go run cmd/contrib/main.go $@ 30 | 31 | $(plugins_dir): 32 | mkdir -p $(plugins_dir) 33 | chmod 700 $(plugins_dir) 34 | chmod 700 ${config_dir} 35 | chmod 700 ${config_dir}/plugins 36 | 37 | %/build: $(plugins_dir) registry beta-notice 38 | $(eval plugin := $(firstword $(subst /, ,$@))) 39 | @go run cmd/contrib/main.go $(plugin)/exists 40 | go build -o $(plugins_dir)/$(plugin) -ldflags="-X 'main.PluginName=$(plugin)'" ./cmd/contrib/build/ 41 | 42 | test: 43 | go test ./... 44 | 45 | lint: 46 | # Version used should stay in sync with version in CI (.github/workflows/test.yaml). 47 | docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run 48 | 49 | %/remove-local: beta-notice 50 | $(eval plugin := $(firstword $(subst /, ,$@))) 51 | rm -f ~/.op/plugins/local/$(plugin) 52 | -------------------------------------------------------------------------------- /plugins/vercel/api_token_test.go: -------------------------------------------------------------------------------- 1 | package vercel 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner( 13 | t, APIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 14 | "default": { 15 | ItemFields: map[sdk.FieldName]string{ 16 | fieldname.Token: "tZk79pLyPLGgUVlkHbnLeXgl", 17 | }, 18 | ExpectedOutput: sdk.ProvisionOutput{ 19 | CommandLine: []string{"--token", "tZk79pLyPLGgUVlkHbnLeXgl"}, 20 | }, 21 | }, 22 | }, 23 | ) 24 | } 25 | 26 | func TestAPITokenImporter(t *testing.T) { 27 | plugintest.TestImporter( 28 | t, APIToken().Importer, map[string]plugintest.ImportCase{ 29 | "config file (macOS)": { 30 | OS: "darwin", 31 | Files: map[string]string{ 32 | "~/Library/Application Support/com.vercel.cli/auth.json": plugintest.LoadFixture(t, "auth.json"), 33 | }, 34 | ExpectedCandidates: []sdk.ImportCandidate{ 35 | { 36 | Fields: map[sdk.FieldName]string{ 37 | fieldname.Token: "tZk79pLyPLGgUVlkHbnLeXgl", 38 | }, 39 | }, 40 | }, 41 | }, 42 | "config file (Linux)": { 43 | OS: "linux", 44 | Files: map[string]string{ 45 | "~/.config/com.vercel.cli/auth.json": plugintest.LoadFixture(t, "auth.json"), 46 | }, 47 | ExpectedCandidates: []sdk.ImportCandidate{ 48 | { 49 | Fields: map[sdk.FieldName]string{ 50 | fieldname.Token: "tZk79pLyPLGgUVlkHbnLeXgl", 51 | }, 52 | }, 53 | }, 54 | }, 55 | }, 56 | ) 57 | } 58 | -------------------------------------------------------------------------------- /plugins/civo/api_key_test.go: -------------------------------------------------------------------------------- 1 | package civo 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPIKeyProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE", 16 | }, 17 | ExpectedOutput: sdk.ProvisionOutput{ 18 | Environment: map[string]string{ 19 | "CIVO_TOKEN": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE", 20 | }, 21 | }, 22 | }, 23 | }) 24 | } 25 | 26 | func TestAPIKeyImporter(t *testing.T) { 27 | plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{ 28 | "environment": { 29 | Environment: map[string]string{ 30 | "CIVO_TOKEN": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE", 31 | }, 32 | ExpectedCandidates: []sdk.ImportCandidate{ 33 | { 34 | Fields: map[sdk.FieldName]string{ 35 | fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE", 36 | }, 37 | }, 38 | }, 39 | }, 40 | 41 | "config file": { 42 | Files: map[string]string{ 43 | 44 | "~/.civo.json": plugintest.LoadFixture(t, ".civo.json"), 45 | }, 46 | ExpectedCandidates: []sdk.ImportCandidate{ 47 | { 48 | Fields: map[sdk.FieldName]string{ 49 | fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE", 50 | }, 51 | NameHint: "testdemoname", 52 | }, 53 | }, 54 | }, 55 | }) 56 | } 57 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/4-issue-contributing.yml: -------------------------------------------------------------------------------- 1 | name: "👷 Contribution and submitting new plugins" 2 | description: I have an issue or feature request around submitting new plugins or contributing in general. 3 | body: 4 | - type: dropdown 5 | id: location 6 | attributes: 7 | label: What does it concern? 8 | options: 9 | - The plugin SDK, design, or schema 10 | - The Makefile commands and tooling 11 | - The contribution process as a whole 12 | - Other 13 | validations: 14 | required: true 15 | - type: textarea 16 | id: desired 17 | attributes: 18 | label: Goal or desired behavior 19 | description: What are you trying to achieve with the SDK, schema, contribution process, etc. that's currently not working well? 20 | validations: 21 | required: true 22 | - type: textarea 23 | id: current 24 | attributes: 25 | label: Current behavior 26 | description: What does the status quo look like? Why is that bad? Any workarounds worth mentioning? 27 | validations: 28 | required: true 29 | - type: textarea 30 | id: logs 31 | attributes: 32 | label: Relevant log output 33 | description: If this is a bug, add any relevant log output. This will be automatically formatted into code, so no need for backticks. 34 | render: shell 35 | - type: input 36 | id: cli-version 37 | attributes: 38 | label: op CLI version 39 | description: "If relevant, add the output of: op --version" 40 | - type: input 41 | id: repo-ref 42 | attributes: 43 | label: shell-plugins local ref 44 | description: "If relevant, add the output of: git show-ref -s refs/heads/main" 45 | -------------------------------------------------------------------------------- /plugins/akamai/akamai.go: -------------------------------------------------------------------------------- 1 | package akamai 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/needsauth" 6 | "github.com/1Password/shell-plugins/sdk/schema" 7 | "github.com/1Password/shell-plugins/sdk/schema/credname" 8 | ) 9 | 10 | func AkamaiCLI() schema.Executable { 11 | return schema.Executable{ 12 | Name: "Akamai CLI", 13 | Runs: []string{"akamai"}, 14 | DocsURL: sdk.URL("https://techdocs.akamai.com/developer/docs/about-clis"), 15 | NeedsAuth: needsauth.IfAll( 16 | needsauth.NotForHelpOrVersion(), 17 | needsauth.NotWithoutArgs(), 18 | needsauth.NotWhenContainsArgs("config"), // skip 1Password authentication for "akamai config" and its subcommands 19 | needsauth.NotWhenContainsArgs("install"), // skip 1Password authentication for "akamai install" and its subcommands 20 | needsauth.NotWhenContainsArgs("get"), // skip 1Password authentication for "akamai get" and its subcommands 21 | needsauth.NotWhenContainsArgs("list"), // skip 1Password authentication for "akamai list" and its subcommands 22 | needsauth.NotWhenContainsArgs("search"), // skip 1Password authentication for "akamai search" and its subcommands 23 | needsauth.NotWhenContainsArgs("uninstall"), // skip 1Password authentication for "akamai uninstall" and its subcommands 24 | needsauth.NotWhenContainsArgs("update"), // skip 1Password authentication for "akamai update" and its subcommands 25 | needsauth.NotWhenContainsArgs("upgrade"), // skip 1Password authentication for "akamai upgrade" and its subcommands 26 | ), 27 | Uses: []schema.CredentialUsage{ 28 | { 29 | Name: credname.APIClientCredentials, 30 | }, 31 | }, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/1-new-plugin-request.yml: -------------------------------------------------------------------------------- 1 | name: "✨ New plugin request" 2 | description: I'd like to request a new plugin. 3 | title: "New plugin: " 4 | labels: ["plugin-request"] 5 | body: 6 | - type: input 7 | id: plugin 8 | attributes: 9 | label: Platform or tool 10 | description: Which platform or tool would you like to see a shell plugin for? 11 | placeholder: e.g. AWS, Stripe, GitHub 12 | validations: 13 | required: true 14 | - type: textarea 15 | id: links 16 | attributes: 17 | label: Relevant links 18 | description: "For example: the platform homepage, CLI docs, authentication docs." 19 | placeholder: | 20 | * https://example.com 21 | * https://example.com/docs/cli 22 | * https://example.com/docs/authentication 23 | validations: 24 | required: true 25 | - type: textarea 26 | id: goal 27 | attributes: 28 | label: Goal or desired behavior 29 | description: What should the plugin do? 30 | placeholder: "For example: Authenticate the CLI using a Personal Access Token." 31 | validations: 32 | required: true 33 | - type: checkboxes 34 | id: contribution 35 | attributes: 36 | label: Contribution 37 | description: Shell Plugins are a community effort, so you're more than welcome to [build the plugin yourself](https://developer.1password.com/docs/cli/shell-plugins/contribute/)! We're here to help when you have any questions. 38 | options: 39 | - label: I'd be up for building the plugin myself. 40 | - type: textarea 41 | id: info 42 | attributes: 43 | label: Additional information 44 | description: Any additional information that's relevant to add? 45 | -------------------------------------------------------------------------------- /sdk/importer/env_var_importer.go: -------------------------------------------------------------------------------- 1 | package importer 2 | 3 | import ( 4 | "context" 5 | "os" 6 | 7 | "github.com/1Password/shell-plugins/sdk" 8 | ) 9 | 10 | // TryAllEnvVars tries the specified environment variables one by one and adds import candidates with 11 | // the specified field for each environment variable that is set. 12 | func TryAllEnvVars(fieldName sdk.FieldName, possibleEnvVarNames ...string) sdk.Importer { 13 | return func(ctx context.Context, in sdk.ImportInput, out *sdk.ImportOutput) { 14 | for _, envVarName := range possibleEnvVarNames { 15 | attempt := out.NewAttempt(SourceEnvVars(envVarName)) 16 | 17 | if value := os.Getenv(envVarName); value != "" { 18 | attempt.AddCandidate(sdk.ImportCandidate{ 19 | Fields: map[sdk.FieldName]string{ 20 | fieldName: value, 21 | }, 22 | }) 23 | } 24 | } 25 | } 26 | } 27 | 28 | // TryEnvVarPair tries the specified environment variables and adds an import candidate if at least 29 | // one environment variable is set. 30 | func TryEnvVarPair(pairPossibilities map[string]sdk.FieldName) sdk.Importer { 31 | return func(ctx context.Context, in sdk.ImportInput, out *sdk.ImportOutput) { 32 | var envVarNames []string 33 | candidateFields := make(map[sdk.FieldName]string) 34 | 35 | for possibleEnvVarName, fieldName := range pairPossibilities { 36 | if value := os.Getenv(possibleEnvVarName); value != "" { 37 | candidateFields[fieldName] = value 38 | } 39 | 40 | envVarNames = append(envVarNames, possibleEnvVarName) 41 | } 42 | 43 | attempt := out.NewAttempt(SourceEnvVars(envVarNames...)) 44 | if len(candidateFields) > 0 { 45 | attempt.AddCandidate(sdk.ImportCandidate{ 46 | Fields: candidateFields, 47 | }) 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /plugins/binance/api_key_test.go: -------------------------------------------------------------------------------- 1 | package binance 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPIKeyProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.APIKey: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE", 16 | fieldname.APISecret: "2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qjThmEycY2J0RgJgNNrWQBqEXAMPLE", 17 | }, 18 | ExpectedOutput: sdk.ProvisionOutput{ 19 | Environment: map[string]string{ 20 | "BINANCE_API_KEY": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE", 21 | "BINANCE_API_SECRET": "2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qjThmEycY2J0RgJgNNrWQBqEXAMPLE", 22 | }, 23 | }, 24 | }, 25 | }) 26 | } 27 | 28 | func TestAPIKeyImporter(t *testing.T) { 29 | plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{ 30 | "environment": { 31 | Environment: map[string]string{ 32 | "BINANCE_API_KEY": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE", 33 | "BINANCE_API_SECRET": "2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qjThmEycY2J0RgJgNNrWQBqEXAMPLE", 34 | }, 35 | ExpectedCandidates: []sdk.ImportCandidate{ 36 | { 37 | Fields: map[sdk.FieldName]string{ 38 | fieldname.APIKey: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE", 39 | fieldname.APISecret: "2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qjThmEycY2J0RgJgNNrWQBqEXAMPLE", 40 | }, 41 | }, 42 | }, 43 | }, 44 | }) 45 | } 46 | -------------------------------------------------------------------------------- /plugins/postgresql/database_credentials_test.go: -------------------------------------------------------------------------------- 1 | package postgresql 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestDatabaseCredentialsImporter(t *testing.T) { 12 | plugintest.TestImporter(t, DatabaseCredentials().Importer, map[string]plugintest.ImportCase{ 13 | "default": { 14 | Environment: map[string]string{ 15 | "PGHOST": "localhost", 16 | "PGPORT": "5432", 17 | "PGUSER": "root", 18 | "PGPASSWORD": "123456", 19 | "PGDATABASE": "test", 20 | }, 21 | ExpectedCandidates: []sdk.ImportCandidate{ 22 | { 23 | Fields: map[sdk.FieldName]string{ 24 | fieldname.Host: "localhost", 25 | fieldname.Port: "5432", 26 | fieldname.User: "root", 27 | fieldname.Password: "123456", 28 | fieldname.Database: "test", 29 | }, 30 | }, 31 | }, 32 | }, 33 | }) 34 | } 35 | 36 | func TestDatabaseCredentialsProvisioner(t *testing.T) { 37 | plugintest.TestProvisioner(t, DatabaseCredentials().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 38 | "default": { 39 | ItemFields: map[sdk.FieldName]string{ 40 | fieldname.Host: "localhost", 41 | fieldname.Port: "5432", 42 | fieldname.User: "root", 43 | fieldname.Password: "123456", 44 | fieldname.Database: "test", 45 | }, 46 | ExpectedOutput: sdk.ProvisionOutput{ 47 | Environment: map[string]string{ 48 | "PGHOST": "localhost", 49 | "PGPORT": "5432", 50 | "PGUSER": "root", 51 | "PGPASSWORD": "123456", 52 | "PGDATABASE": "test", 53 | }, 54 | }, 55 | }, 56 | }) 57 | } 58 | -------------------------------------------------------------------------------- /plugins/yugabytedb/database_credentials_test.go: -------------------------------------------------------------------------------- 1 | package yugabytedb 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestDatabaseCredentialsImporter(t *testing.T) { 12 | plugintest.TestImporter(t, DatabaseCredentials().Importer, map[string]plugintest.ImportCase{ 13 | "yugabyte": { 14 | Environment: map[string]string{ 15 | "PGHOST": "localhost", 16 | "PGPORT": "5432", 17 | "PGUSER": "root", 18 | "PGPASSWORD": "123456", 19 | "PGDATABASE": "test", 20 | }, 21 | ExpectedCandidates: []sdk.ImportCandidate{ 22 | { 23 | Fields: map[sdk.FieldName]string{ 24 | fieldname.Host: "localhost", 25 | fieldname.Port: "5432", 26 | fieldname.Username: "root", 27 | fieldname.Password: "123456", 28 | fieldname.Database: "test", 29 | }, 30 | }, 31 | }, 32 | }, 33 | }) 34 | } 35 | 36 | func TestDatabaseCredentialsProvisioner(t *testing.T) { 37 | plugintest.TestProvisioner(t, DatabaseCredentials().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 38 | "default": { 39 | ItemFields: map[sdk.FieldName]string{ 40 | fieldname.Host: "localhost", 41 | fieldname.Port: "5432", 42 | fieldname.Username: "root", 43 | fieldname.Password: "123456", 44 | fieldname.Database: "test", 45 | }, 46 | ExpectedOutput: sdk.ProvisionOutput{ 47 | Environment: map[string]string{ 48 | "PGHOST": "localhost", 49 | "PGPORT": "5432", 50 | "PGUSER": "root", 51 | "PGPASSWORD": "123456", 52 | "PGDATABASE": "test", 53 | }, 54 | }, 55 | }, 56 | }, 57 | ) 58 | } 59 | -------------------------------------------------------------------------------- /plugins/atlas/apikey.go: -------------------------------------------------------------------------------- 1 | package atlas 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func APIKey() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.APIKey, 15 | DocsURL: sdk.URL("https://www.mongodb.com/docs/atlas/configure-api-access/"), 16 | ManagementURL: nil, 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.PublicKey, 20 | MarkdownDescription: "Public key used to authenticate to MongoDB Atlas.", 21 | Secret: false, 22 | Composition: &schema.ValueComposition{ 23 | Length: 8, 24 | Charset: schema.Charset{ 25 | Lowercase: true, 26 | }, 27 | }, 28 | }, 29 | { 30 | Name: fieldname.PrivateKey, 31 | MarkdownDescription: "Private key used to authenticate to MongoDB Atlas.", 32 | Secret: true, 33 | Composition: &schema.ValueComposition{ 34 | Length: 36, 35 | Charset: schema.Charset{ 36 | Lowercase: true, 37 | Digits: true, 38 | Specific: []rune{'-'}, 39 | }, 40 | }, 41 | }, 42 | }, 43 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 44 | Importer: importer.TryAll( 45 | importer.TryEnvVarPair(defaultEnvVarMapping), 46 | )} 47 | } 48 | 49 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 50 | "MONGODB_ATLAS_PUBLIC_API_KEY": fieldname.PublicKey, 51 | "MONGODB_ATLAS_PRIVATE_API_KEY": fieldname.PrivateKey, 52 | } 53 | -------------------------------------------------------------------------------- /plugins/vertica/database_credentials_test.go: -------------------------------------------------------------------------------- 1 | package vertica 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestDatabaseCredentialsProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, DatabaseCredentials().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Username: "vertica", 16 | fieldname.Password: "Il0v3y04", 17 | fieldname.Host: "localhost", 18 | fieldname.Port: "5433", 19 | fieldname.Database: "VMart", 20 | }, 21 | ExpectedOutput: sdk.ProvisionOutput{ 22 | Environment: map[string]string{ 23 | "VSQL_USER": "vertica", 24 | "VSQL_PASSWORD": "Il0v3y04", 25 | "VSQL_HOST": "localhost", 26 | "VSQL_PORT": "5433", 27 | "VSQL_DATABASE": "VMart", 28 | }, 29 | }, 30 | }, 31 | }) 32 | } 33 | 34 | func TestAPIKeyImporter(t *testing.T) { 35 | plugintest.TestImporter(t, DatabaseCredentials().Importer, map[string]plugintest.ImportCase{ 36 | "environment": { 37 | Environment: map[string]string{ 38 | "VSQL_USER": "vertica", 39 | "VSQL_PASSWORD": "Il0v3y04", 40 | "VSQL_HOST": "localhost", 41 | "VSQL_PORT": "5433", 42 | "VSQL_DATABASE": "VMart", 43 | }, 44 | ExpectedCandidates: []sdk.ImportCandidate{ 45 | { 46 | Fields: map[sdk.FieldName]string{ 47 | fieldname.Username: "vertica", 48 | fieldname.Password: "Il0v3y04", 49 | fieldname.Host: "localhost", 50 | fieldname.Port: "5433", 51 | fieldname.Database: "VMart", 52 | }, 53 | }, 54 | }, 55 | }, 56 | }) 57 | } 58 | -------------------------------------------------------------------------------- /plugins/pipedream/api_key_test.go: -------------------------------------------------------------------------------- 1 | package pipedream 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPIKeyProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "config file": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.APIKey: "ugvfxesz62ycsl42z49c0t1hjexample", 16 | fieldname.OrgID: "YbEXAMPLE", 17 | }, 18 | ExpectedOutput: sdk.ProvisionOutput{ 19 | Files: map[string]sdk.OutputFile{ 20 | "~/.config/pipedream/config": { 21 | Contents: []byte(plugintest.LoadFixture(t, "provision")), 22 | }, 23 | }, 24 | }, 25 | }, 26 | }) 27 | } 28 | 29 | func TestAPIKeyImporter(t *testing.T) { 30 | plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{ 31 | "config file": { 32 | Files: map[string]string{ 33 | "~/.config/pipedream/config": plugintest.LoadFixture(t, "import"), 34 | }, 35 | ExpectedCandidates: []sdk.ImportCandidate{ 36 | { 37 | Fields: map[sdk.FieldName]string{ 38 | fieldname.APIKey: "ugvfxesz62ycsl42z49c0t1hjexample", 39 | fieldname.OrgID: "YbEXAMPLE", 40 | }, 41 | NameHint: "DEFAULT", 42 | }, 43 | { 44 | Fields: map[sdk.FieldName]string{ 45 | fieldname.APIKey: "5puf32rvhkz83c6oj4wpxvaniexample", 46 | fieldname.OrgID: "KVEXAMPLE", 47 | }, 48 | NameHint: "first", 49 | }, 50 | { 51 | Fields: map[sdk.FieldName]string{ 52 | fieldname.APIKey: "lgx1amb0qf7mjy6y7nkgfc3x9example", 53 | }, 54 | NameHint: "second", 55 | }, 56 | }, 57 | }, 58 | }) 59 | } 60 | -------------------------------------------------------------------------------- /plugins/binance/api_key.go: -------------------------------------------------------------------------------- 1 | package binance 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func APIKey() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.APIKey, 15 | DocsURL: sdk.URL("https://github.com/binance/binance-cli"), 16 | ManagementURL: sdk.URL("https://www.binance.com/en/my/settings/api-management"), 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.APIKey, 20 | MarkdownDescription: "API Key used to authenticate to Binance.", 21 | Secret: true, 22 | Composition: &schema.ValueComposition{ 23 | Length: 64, 24 | Charset: schema.Charset{ 25 | Uppercase: true, 26 | Lowercase: true, 27 | Digits: true, 28 | }, 29 | }, 30 | }, 31 | { 32 | Name: fieldname.APISecret, 33 | MarkdownDescription: "API Key secret used to authenticate to Binance.", 34 | Secret: true, 35 | Composition: &schema.ValueComposition{ 36 | Length: 64, 37 | Charset: schema.Charset{ 38 | Uppercase: true, 39 | Lowercase: true, 40 | Digits: true, 41 | }, 42 | }, 43 | }, 44 | }, 45 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 46 | Importer: importer.TryEnvVarPair(defaultEnvVarMapping)} 47 | } 48 | 49 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 50 | "BINANCE_API_KEY": fieldname.APIKey, 51 | "BINANCE_API_SECRET": fieldname.APISecret, 52 | } 53 | -------------------------------------------------------------------------------- /plugins/sourcegraph/access_token.go: -------------------------------------------------------------------------------- 1 | package sourcegraph 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func AccessToken() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.AccessToken, 15 | DocsURL: sdk.URL("https://docs.sourcegraph.com/cli"), 16 | ManagementURL: sdk.URL("https://sourcegraph.com/user/settings/tokens"), 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.Endpoint, 20 | MarkdownDescription: "Base URL for your Sourcegraph instance.", 21 | Secret: false, 22 | Optional: true, 23 | Composition: &schema.ValueComposition{ 24 | Charset: schema.Charset{ 25 | Lowercase: true, 26 | Digits: true, 27 | Symbols: true, 28 | }, 29 | }, 30 | }, 31 | { 32 | Name: fieldname.Token, 33 | MarkdownDescription: "Token used to authenticate to Sourcegraph.", 34 | Secret: true, 35 | Composition: &schema.ValueComposition{ 36 | Length: 40, 37 | Charset: schema.Charset{ 38 | Lowercase: true, 39 | Digits: true, 40 | }, 41 | }, 42 | }, 43 | }, 44 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 45 | Importer: importer.TryAll( 46 | importer.TryEnvVarPair(defaultEnvVarMapping), 47 | )} 48 | } 49 | 50 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 51 | "SRC_ENDPOINT": fieldname.Endpoint, 52 | "SRC_ACCESS_TOKEN": fieldname.Token, 53 | } 54 | -------------------------------------------------------------------------------- /plugins/vault/auth_token.go: -------------------------------------------------------------------------------- 1 | package vault 2 | 3 | import ( 4 | "github.com/1Password/shell-plugins/sdk" 5 | "github.com/1Password/shell-plugins/sdk/importer" 6 | "github.com/1Password/shell-plugins/sdk/provision" 7 | "github.com/1Password/shell-plugins/sdk/schema" 8 | "github.com/1Password/shell-plugins/sdk/schema/credname" 9 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 10 | ) 11 | 12 | func AuthToken() schema.CredentialType { 13 | return schema.CredentialType{ 14 | Name: credname.AuthToken, 15 | DocsURL: sdk.URL("https://developer.hashicorp.com/vault/docs/concepts/tokens"), 16 | ManagementURL: nil, // TODO: Add management URL 17 | Fields: []schema.CredentialField{ 18 | { 19 | Name: fieldname.Token, 20 | MarkdownDescription: "Token used to authenticate to HashiCorp Vault.", 21 | Secret: true, 22 | }, 23 | { 24 | Name: fieldname.Address, 25 | MarkdownDescription: "Default address of the Vault server to use for this auth token.", 26 | Optional: true, 27 | }, 28 | { 29 | Name: fieldname.Namespace, 30 | MarkdownDescription: "Default namespace to use for this auth token.", 31 | Optional: true, 32 | }, 33 | }, 34 | DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping), 35 | Importer: importer.TryAll( 36 | importer.TryEnvVarPair(defaultEnvVarMapping), 37 | TryVaultTokenFile(), 38 | ), 39 | } 40 | } 41 | 42 | var defaultEnvVarMapping = map[string]sdk.FieldName{ 43 | "VAULT_TOKEN": fieldname.Token, 44 | "VAULT_ADDR": fieldname.Address, 45 | "VAULT_NAMESPACE": fieldname.Namespace, 46 | } 47 | 48 | func TryVaultTokenFile() sdk.Importer { 49 | // TODO: Try importing from ~/.vault-token file 50 | return importer.NoOp() 51 | } 52 | -------------------------------------------------------------------------------- /plugins/kaggle/api_token_test.go: -------------------------------------------------------------------------------- 1 | package kaggle 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/1Password/shell-plugins/sdk" 7 | "github.com/1Password/shell-plugins/sdk/plugintest" 8 | "github.com/1Password/shell-plugins/sdk/schema/fieldname" 9 | ) 10 | 11 | func TestAPITokenProvisioner(t *testing.T) { 12 | plugintest.TestProvisioner(t, APIToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{ 13 | "default": { 14 | ItemFields: map[sdk.FieldName]string{ 15 | fieldname.Token: "z2pifkruzgbb17plmz2gux21fexample", 16 | fieldname.Username: "username", 17 | }, 18 | ExpectedOutput: sdk.ProvisionOutput{ 19 | Environment: map[string]string{ 20 | "KAGGLE_KEY": "z2pifkruzgbb17plmz2gux21fexample", 21 | "KAGGLE_USERNAME": "username", 22 | }, 23 | }, 24 | }, 25 | }) 26 | } 27 | 28 | func TestAPITokenImporter(t *testing.T) { 29 | plugintest.TestImporter(t, APIToken().Importer, map[string]plugintest.ImportCase{ 30 | "environment": { 31 | Environment: map[string]string{ 32 | "KAGGLE_KEY": "z2pifkruzgbb17plmz2gux21fexample", 33 | "KAGGLE_USERNAME": "username", 34 | }, 35 | ExpectedCandidates: []sdk.ImportCandidate{ 36 | { 37 | Fields: map[sdk.FieldName]string{ 38 | fieldname.Token: "z2pifkruzgbb17plmz2gux21fexample", 39 | fieldname.Username: "username", 40 | }, 41 | }, 42 | }, 43 | }, 44 | "config file": { 45 | Files: map[string]string{ 46 | "~/.kaggle/kaggle.json": plugintest.LoadFixture(t, "config.json"), 47 | }, 48 | ExpectedCandidates: []sdk.ImportCandidate{ 49 | { 50 | Fields: map[sdk.FieldName]string{ 51 | fieldname.Token: "z2pifkruzgbb17plmz2gux21fexample", 52 | fieldname.Username: "username", 53 | }, 54 | NameHint: "username", 55 | }, 56 | }, 57 | }, 58 | }) 59 | } 60 | --------------------------------------------------------------------------------