AIエディタCursorに、AIコードアシスタントSourcegraph Codyを認証させる方法を運営に教えてもらった。

ツール

AIコードエディタCursorに、コーディングアシスタントであるSourcegraphのCodyをインストールすることに成功した。普通にインストールしようとすると、認証時にVSCodeを開いてしまい、Cursorでは認証できなかった。Twitterでつぶやいたところ、運営から方法を教えてもらうことができたため、まとめておく。

Cursorとは?

Cursor - The AI-first Code Editor
Cursor is the IDE of the future, built for pair-programming with Powerful AI.

GPT4ベースのVSCodeフォークのAIエディタ。非常に使いやすく、長年使ったVSCodeからの乗り換えを決めた。無料枠はGPT4(slow) 50回、GPT3.5(turbo) 200回。月額20ドルまたは年払いで月額16ドル。Cursorについては、別途記事を作成する予定。

Sourcegraph Codyとは?

Cody | AI coding assistant
Cody is the most powerful and accurate AI coding assistant for writing, fixing, and maintaining code.

Claude 2ベースのVSCodeエクステンション。Github Copilotと同じように、オートコンプリートでコード補完をしてくれる。しかも個人開発者は無料。Claudeを使ったコードアシスタントは恐らくこれだけ。ClaudeベースであることはClaudeのサイトからわかった。

Sourcegraph is a code AI platform that helps customers write, fix, and maintain code. Their coding assistant Cody uses Claude 2’s improved reasoning ability to give even more accurate answers to user queries while also passing along more codebase context with up to 100K context windows. In addition, Claude 2 was trained on more recent data, meaning it has knowledge of newer frameworks and libraries for Cody to pull from. “When it comes to AI coding, devs need fast and reliable access to context about their unique codebase and a powerful LLM with a large context window and strong general reasoning capabilities,” says Quinn Slack, CEO & Co-founder of Sourcegraph. “The slowest and most frustrating parts of the dev workflow are becoming faster and more enjoyable. Thanks to Claude 2, Cody’s helping more devs build more software that pushes the world forward.”

https://www.anthropic.com/index/claude-2

Sourcegraph は、顧客のコードの作成、修正、保守を支援するコード AI プラットフォームです。 コーディング アシスタントの Cody は、Claude 2 の向上した推論能力を利用して、ユーザーのクエリに対してさらに正確な回答を提供しながら、最大 100K のコンテキスト ウィンドウでより多くのコードベース コンテキストを渡します。 さらに、Claude 2 はより最近のデータでトレーニングされており、Cody が利用できる新しいフレームワークとライブラリに関する知識を持っています。 「AI コーディングに関しては、開発者は独自のコードベースに関するコンテキストへの高速かつ信頼性の高いアクセスと、大きなコンテキスト ウィンドウと強力な一般推論機能を備えた強力な LLM を必要とします」と、Sourcegraph の CEO 兼共同創設者である Quinn Slack は述べています。 「開発ワークフローの中で最も遅く、最もイライラする部分が、より速く、より楽しくなってきています。 クロード 2 のおかげで、コーディはより多くの開発者が世界を前進させるソフトウェアを構築できるよう支援しています。」

https://www.anthropic.com/index/claude-2

CursorからCodyを認証する際に失敗したときの様子

まずは、Cursorのエクステンションからcodyを検索して、sourcegraphのCody AIをインストールする。

Cody extension

Codyを選択すると、以下の画面となる。

Sign in Cody

Sign Inをすると、以下がブラウザで表示され、

Authorize Cody

Authorizeをクリックすると、VSCodeをOpenする旨が表示される。CursorからAuthorizeしたはずなのに、VSCodeが開いて認証されてしまう。そのため、VSCodeではCodyが使えるようになるが、Cursorでは認証が通らなかった。

Open Visual Studio Code

運営から教えてもらった認証方法

以下、Twitterでつぶやいたところ、運営がすぐにやり方を教えてくれた!

I failed to run @SourcegraphCody with Cursor (AI editor). The authorization opens VS Code and it cannot authorize in Cursor. I wanted to use Cody instead of Github Copilot…

https://twitter.com/agile_kumamushi/status/1719719380060422356

Hi! You can achieve this by creating a token in your settings and generating a new token, then “sign in with URL and access token” for the URL use `https://sourcegraph-com` (replace – with .)

https://twitter.com/SourcegraphCody/status/1719726801709310165

ただ、このやり方もすぐにわかるわけではなかった。以下に方法を示す。

Authorize Cody

まず、Sign inをしてブラウザでこの表示にする。その後、Cancelをクリックすると、以下のAccess tokenのページが表示される。

Cody Access tokens

Generate new tokenをクリックし、名前を入力してGenerateする。

Cody new access token

作成したtokenをコピーし、Cursorで、Cody: Switch Account…を選択する。

cody switch account

Sign in with URL and Access Tokenを選択する。

cody sign in with URL and Access Token

URL: sourcegraph.com

Token: 先ほどコピーしたもの

とすると、認証が完了する。すると、先ほどのSign inが表示されていた部分でCHATが使えるようになり、Github Copilotのようにコード補完をしてくれるようになる。

とsangminさんが言っており、Github Copilotは解約しても良いかもしれない。

CursorはGPT4のため、ClaudeのCodyと一緒に使えば結構良いのではと思っている。

コメント

タイトルとURLをコピーしました