github / gh-copilot

Ask for assistance right in your terminal.
https://docs.github.com/en/copilot/github-copilot-in-the-cli
613 stars 19 forks source link

[FEAT]: support GitHub Copilot Chat #36

Open SIMULATAN opened 4 months ago

SIMULATAN commented 4 months ago

Describe the need

In order to streamline the development process for people living in the command line, it would be awesome to have GitHub Copilot Chat in the CLI extension. This way, you can for ex. ask it for help regarding a file in the current directory.

My current use case is to get help with a Kustomize patch, which I'm editing in vim.

Note

I am aware that GitHub Copilot Chat is still in its early stages. I'm merely opening this issue to voice the demand and, potentially, spark a discussion regarding this, also considering the backing interface.

rlove commented 3 months ago

I like this idea, to add a use case in support of this.

I have lower range of vision. I have found PowerShell and Bash to very helpful, as it's an interface that I know and can always depend on, instead of searching for things found in a menu and results in fonts that are not as always as clear of what I can setup with a basic terminal window.

andyfeller commented 3 months ago

@SIMULATAN @rlove : thank you for opening this issue, sharing this idea and your experiences! ❤

This touches on an avenue I find interesting when this effort was originally starting and looking at other tools in the space. In the case of Vim — which is my favorite editor too — there have been similar asks to bring IDE chat support to the Neovim plugin. I'm unsure of the funding behind that though there is a 3rd party Neovim plugin that attempts to support it: https://github.com/CopilotC-Nvim/CopilotChat.nvim

mxie commented 3 months ago

Thanks for your feedback and use cases @SIMULATAN and @rlove!

Just so I understand correctly, this idea is about bringing chat to the command line and not text editors like vim, right?

SIMULATAN commented 3 months ago

Thanks for your feedback and use cases @SIMULATAN and @rlove!

Just so I understand correctly, this idea is about bringing chat to the command line and not text editors like vim, right?

Yes! My (personal) idea would be to add it as a subcommand to the existing gh copilot command. I think it would fit well there.

The main reason why I didn't try to implement this myself yet is because I couldn't find any documentation on a GitHub Copilot API. Hence, I believe the vim integration efforts could serve as a reference implementation.

mxie commented 3 months ago

Got it - thanks for the clarification! Supporting chat is something we definitely considered but decided to punt on until we get feedback from folks like yourself. 😄 I'll bring this back to the team to discuss!

The main reason why I didn't try to implement this myself yet is because I couldn't find any documentation on a GitHub Copilot API.

That's because it's not publicly available. :)

GerbenRampaart commented 1 month ago

Thanks for submitting this! I would love for chat to be supported by github cli.

My use case is for automating purposes. We (large enterprise) have resources, like documentation and source repositories (bitbucket) running on-prem.

It would be really nice if I could consume these resources, write them locally for the length of a chat command, and include them using #file:, for example to generate changelogs for PRs.

Just as a suggestion: you could introduce the env variable GH_WORKSPACE, that resolves, if set, to a directory when you include the @workspace in

gh copilot chat @workspace please summarize file #file:some_file.txt

GerbenRampaart commented 1 month ago

@mxie could you shed some light on the priority the chat feature has for you (if any).

Thank you

jvkaam commented 1 month ago

@mxie I could indeed see a lot of opportunities to automate.

andyfeller commented 3 weeks ago

It would be really nice if I could consume these resources, write them locally for the length of a chat command, and include them using #file:, for example to generate changelogs for PRs.

@GerbenRampaart @jvkaam : handful of questions:

  1. would you also expect GitHub Copilot to read the local git repository log for commit messages for generating the changelog?
  2. given the interest in automation, what types of rate limits might you expect in terms of requests as well as token limits?
  3. any need to pick up a previous session to continue, building on the conversation?
GerbenRampaart commented 3 weeks ago

Hi Andy, thanks for the questions.

  1. That feels like an overextension of the plugin. (in my opinion). It would be amazing if the basic functionality of chat is supported by the cli. Meaning everything an IDE chat does, the cli does the same. Obviously some things are different, like there is no assumed workspace, (because it being a cli) so a way of setting the WORKSPACE_DIR or GH_WORKSPACE is necessary.

  2. We are using Github Enterprise in my company with hundreds of users. I'm not sure how rate limiting works for us in terms of requests. In terms of tokens however, it's hard for me to find good info on the allowed token and request limits, I have successfully experimented in vscode with summarising ebooks with hundreds of pages, which worked fine. So I'm guessing the current supported defaults of any IDE is fine. like 8k (tokens) for the question and 1MB for the data maybe?

  3. Interesting question. For a first release of chat for the GitHub cli, this feels like an overextension (but I'm not saying no to cool features obviously 🥇). When using the GitHub copilot cli in automated scenarios, things like resolving urls to text input or saving sessions is very solvable in a bash or programmatic context in my opinion.