Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new Cohere Cli plugin #334

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

parthiv11
Copy link
Contributor

@parthiv11 parthiv11 commented Jun 29, 2023

Overview

Added cohere cli shell plugin

Type of change

  • Created a new plugin
  • Improved an existing plugin
  • Fixed a bug in an existing plugin
  • Improved contributor utilities or experience

Related Issue(s)

  • Resolves: #
  • Relates: #

How To Test

Changelog

Additional information

@arunsathiya arunsathiya changed the title 👀👀Added new Cohere Cli plugin Added new Cohere Cli plugin Jun 29, 2023
Copy link
Contributor

@arunsathiya arunsathiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @parthiv11, thanks for this submission. A couple of questions:

  • Is this still a work in progress? I see some todo.
  • Could you run gofmt -w . to address the linter errors?
  • The tests don't seem complete. Could you address them, please?

With this understanding, I'll mark this PR as in progress for now, but feel free to ping me once it's ready for a review.

@arunsathiya
Copy link
Contributor

Also, this is a hackathon entry, yes?

@arunsathiya arunsathiya added in-progress this PR is being worked on/comments are in the process of being addressed by the contributor hashnode hackathon Ideas and inspiration for the hackathon running from June 1st - June 30th labels Jun 29, 2023
@techcraver
Copy link
Contributor

techcraver commented Jun 29, 2023

If it is a Hackathon entry - be sure to write a blog post on Hashnode tagged with 1Password and BuildWith1Password. Also, be sure to use Hashnode tags, not just "#1Password". Here's a guide. :)

@parthiv11
Copy link
Contributor Author

@arunsathiya Added tests for cohere plugins

Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution! Looks good, for the most part 😄

Comment on lines 40 to 41
provision.Filename("config"),
provision.AtFixedPath("~/.command/")),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two options, if I recall correctly, are not both taken into consideration.

I think you're looking for `provision.AtFixedPath("~/.command/config").

Comment on lines 77 to 78
if value, ok := in.ItemFields[fieldname.Authtoken]; ok {
jwt = value
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this value is not found, let's bail and return.

plugins/cohere/credentials.go Show resolved Hide resolved
Comment on lines +16 to +17
needsauth.NotForHelpOrVersion(),
needsauth.NotWithoutArgs(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there may be other commands, such as co auth login, that do not require authentication - could you have a look at what all of those may be?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not yet resolved

plugins/cohere/credentials.go Outdated Show resolved Hide resolved
plugins/cohere/credentials.go Outdated Show resolved Hide resolved
plugins/cohere/credentials_test.go Outdated Show resolved Hide resolved
Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there! 🚀 Please make sure to goimports your files, looks like the lint is complaining.

plugins/cohere/credentials.go Outdated Show resolved Hide resolved
plugins/cohere/test-fixtures/config Outdated Show resolved Hide resolved
@hculea
Copy link
Member

hculea commented Jul 4, 2023

Also, please have a look over the failing tests.

@hculea hculea requested review from hculea and arunsathiya and removed request for hculea and arunsathiya July 4, 2023 08:54
@hculea
Copy link
Member

hculea commented Jul 7, 2023

Hey @parthiv11 , I see there hasn't been any activity on this PR in a bit, is there anything that we can help you with?

We'd love to get this to the finish line together! 🚀

@parthiv11
Copy link
Contributor Author

co-2023-07-12_12.28.50.mp4

@hculea i think it is done

Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, your functional test video helps a lot! Only a few more comments related to the code.

plugins/cohere/credentials.go Outdated Show resolved Hide resolved
plugins/cohere/credentials.go Outdated Show resolved Hide resolved
plugins/cohere/credentials.go Outdated Show resolved Hide resolved
@hculea hculea self-requested a review July 17, 2023 10:41
@arunsathiya arunsathiya added waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member and removed in-progress this PR is being worked on/comments are in the process of being addressed by the contributor labels Jul 24, 2023
@parthiv11 parthiv11 force-pushed the cohere branch 2 times, most recently from 9bb9ebf to a991242 Compare July 30, 2023 17:47
"context"

"encoding/json"
"github.com/1Password/shell-plugins/sdk"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's sort imports on this file to make the linter pass.

out.AddCandidate(sdk.ImportCandidate{
Fields: map[sdk.FieldName]string{
fieldname.URL: config.CurrentURL,
fieldname.JWT: config.Contexts[config.CurrentURL].JWT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's format this code so the linter can pass

Copy link
Contributor

@AndyTitu AndyTitu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm mostly. I went ahead and closed all resolved comments. There are still very few open comments which need to be resolved first, as well as some formatting required for the GitHub linter action to pass.

@parthiv11 is this something you can take a look at?

@AndyTitu AndyTitu added in-progress this PR is being worked on/comments are in the process of being addressed by the contributor and removed waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member labels Aug 30, 2023
@parthiv11
Copy link
Contributor Author

@AndyTitu done

@github-actions
Copy link
Contributor

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git commit -S --amend --no-edit) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

@github-actions
Copy link
Contributor

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git commit -S --amend --no-edit) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

@accraw
Copy link
Contributor

accraw commented Oct 18, 2023

Hi @parthiv11 !

It looks like not all the comments are resolved and the linter/tests still aren't passing. Are you able to fix those?

Thank you again for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashnode hackathon Ideas and inspiration for the hackathon running from June 1st - June 30th in-progress this PR is being worked on/comments are in the process of being addressed by the contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants