Skip to content

Latest commit

 

History

History
35 lines (31 loc) · 1.93 KB

README.md

File metadata and controls

35 lines (31 loc) · 1.93 KB

copilot-commit-in-terminal

Copilot extension in vscode commit message input shows a button to automatically generate commit message.alt text

Demo

Now you can do that without leaving your terminal Demo of using it in action

How to use?

⚠️ For the following process, it is assummed that you have copilot access and have setup your vscode with github acccount logged in. You must be able to use copilot commit functionality through UI as shown in GIF above then only you can have that access in terminal.

  1. Clone repo
    git clone https://github.com/Amit0617/copilot-commit-in-terminal.git
    
  2. Put Github Oauth user access token for vscode in aicommit-remote.py file. How to get Github Oauth token?
    # aicommit-remote.py
    ...
    ...
    ...
    if __name__ == "__main__":
        github_token = 'gho_<YOUR_GITHUB_TOKEN>'
        print(generate_commit_message(github_token))
  3. Setup git alias
    git config --global alias.ai-commit '!python3 /path/to/aicommit-remote.py | git commit -F -'

How to get Github OAuth token?

This is not going to be some random token generated by us. This has to be exact user access token copilot extension is using for authorizing access on behalf of your account.

  1. Install mitmproxy.
  2. Launch mitmproxy in console.
  3. Launch vscode and go into Settings (Gear icon in the bottom-left corner). Paste http.proxy in the search bar of settings and populate proxy input with http://localhost:8080.
  4. Check the console which have mitmproxy running. It will show you various Flows. You have to find https://api.github.com/copilot_internal/v2/token endpoint. Press Enter to see body and headers of the Request. authorization key of header consists of the token you are looking for.