sourcegraph / cody

AI that knows your entire codebase
https://cody.dev
Apache License 2.0
2.24k stars 213 forks source link

mentions: add built-in linear-issues provider using linear connect for auth #4660

Closed keegancsmith closed 5 days ago

keegancsmith commented 1 week ago

This PR copies in the current state of the OpenCtx Linear Issues provider (1st commit). We then use integration with the official Linear Connect vscode extension to make authentication smooth (2nd commit). If the extension is missing we prompt the user to install it (3rd commit).

Note: we could declare that Cody depends on the Linear Connect extension. However, given this is opt-in behaviour I prefer our "just in time" prompting of adding that extension. Note that the provider will only be shown if the noodle config setting is enabled.

Test Plan: Try with linear connect in the following states: uninstalled, disabled, enabled. The first two states will always trigger showing the extension. The enabled state will log us in to Linear. I also tested if a user did not finish up the sign in flow, then the same modal would happen again when attempting connecting to Linear.

Demo at https://www.loom.com/share/f37ea88f5d9d47e8b0940aa7b5c0d975

Fixes https://linear.app/sourcegraph/issue/CODY-2540/explore-good-linear-auth-in-openctx

keegancsmith commented 1 week ago

I don't fully understand our architecture here, but I had to avoid importing the LinearIssuesProvider inside of webviews since it imported vscode. I could run this locally fine, but CI didn't like it. I wonder how inflated the webview stuff is due to other small imports just to get at a string. See this commit which fixed it https://github.com/sourcegraph/cody/pull/4660/commits/94083319f2c263f361e753833fd4dd7417a0377a

keegancsmith commented 5 days ago

After discussion we decided its better to try and make these sort of things work in openctx without needing to be in the cody repo. This PR makes it possible to implement linear connect as a normal third party provider https://github.com/sourcegraph/openctx/pull/161