PEZ / backseat-driver

The Hackable VS Code AI Assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backseat Driver

The Hackable VS Code AI Assistant.

What is this?

Backseat Driver is a ChatGPT API client for VS Code, similar in concept to the chat part of the GitHub CoPilot extension, but much, much simpler.

It best supports Clojure and ClojureScript coding, but can assist with anything code crafting related. Besdies. And it's a Joyride script, so you can hack in support for your language of choice.

WIP: Or even just a proof of concept for now. But it works!

backseat-driver-demo.mp4

To use it you will need:

  • VS Code
  • The Joyride extension
  • The Calva extension (Backseat Driver depends on some Calva API:s)
  • The npm command line tool (probably you want to have Nodejs installed, even if Nodejs is not a direct dependency for the script)
  • An OpenAI API key available in your environment as OPENAI_API_KEY

Install

Backseat Driver is meant to be a global (User) Joyride script, so that it is available in all your projects. But you can try it out as a local (Workspace) script:

  1. Open this project in VS Code
  2. Install Nodejs dependencies:
    npm i
  3. Reload the VS Code window (from the Command Palette: Developer: Reload Window)
  4. Create a keyboard shortcut to run the Backseat Driver assistant. This registers ctrl+alt/option+, as the shortcut:
     {
         "key": "ctrl+alt+,",
         "command": "joyride.runCode",
         "args": "(backseat-driver.app/please-advice!)",
     },

TBD: Instructions for how to use Backseat Driver as a global/user script.

Usage

Backseat Driver does not automatically edit your code, or even insert suggestions. At least for now it is more similar to having the ChatGPT chat in VS Code, which is aware of your code context. You ask Backseat Driver for assistance, and it will answer based on your question + the code you are editing.

Your conversation with Backseat Driver will be printed in the Backseat Driver output channel. (More fancy UI is being planned).

To ask Backseat Driver for advice, press ctrl+alt/option+,. You should expect it to work like in the demo video above.

The Backseat Driver Menu

In the status bar you will have a button titled Backseat Driver which opens up the Backseat Driver menu. It lets you:

  • Ask the AI for assistance
  • Start a new chat session
  • Show the output channel

Tips

In the demo above I have placed the Backseat output channel in the Secondary Sidebar. (Search for it in the Command Palette if you're not in the know).

To show the channel at will you can bind a keyboard shortcut, like so:

    {
        "key": "ctrl+alt+a ctrl+alt+a",
        "command": "joyride.runCode",
        "args": "(backseat.ui/show-channel!)",
    },

NB: Since it's Joyride you can script yourself a menu or a statusbar button for things like this too.

Happy Backseat assisted coding!

Issues welcome.

Since this is a Joyride script, it is meant that you adapt it to your needs. If you add things that you think are generally useful, please don't hesitate to tell me about it in an issue, and we can discuss about if it should be a pull request on this repo.

See typos? Please PR.

See bugs? Please Issue (and please PR too!)

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

The Hackable VS Code AI Assistant

License:MIT License


Languages

Language:Clojure 95.6%Language:JavaScript 4.4%