Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build-with-cody.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
git fetch --prune --unshallow
echo "RELEASE_VERSION=$(git describe --tags)-$CODY_COMMIT" >> $GITHUB_ENV
- run: ./gradlew buildPlugin "-PpluginVersion=$RELEASE_VERSION" "-Pcody.commit=$CODY_COMMIT"
env:
GITHUB_TOKEN: ${{ secrets.CODY_GITHUB_TOKEN }}
- run: ./gradlew --stop
- name: Upload the plugin package
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/experimental-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ jobs:
./gradlew "-PpluginVersion=${RELEASE_VERSION}" publishPlugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.CODY_GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ jobs:
./gradlew "-PpluginVersion=${RELEASE_VERSION}" publishPlugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.CODY_GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/stable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ jobs:
- run: ./gradlew "-PpluginVersion=$RELEASE_VERSION" publishPlugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.CODY_GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,24 @@ jobs:
cache: gradle
# Skip Code Search build in CI because it's slow, and we don't use it anyway for testing purposes.
- run: echo "SKIP_CODE_SEARCH_BUILD=true" >> $GITHUB_ENV
# Checkout Cody and generate protocol files
- name: Checkout Cody
uses: actions/checkout@v4
with:
repository: sourcegraph/cody
token: ${{ secrets.CODY_GITHUB_TOKEN }}
path: .cody-repo
- name: Install Cody Dependencies
run: |
cd .cody-repo
pnpm install --prefer-offline
- run: echo "CODY_DIR=${{ github.workspace }}/.cody-repo" >> $GITHUB_ENV
- run: ./gradlew spotlessCheck
env:
GITHUB_TOKEN: ${{ secrets.CODY_GITHUB_TOKEN }}
- run: ./gradlew check
env:
GITHUB_TOKEN: ${{ secrets.CODY_GITHUB_TOKEN }}
- name: Upload the test report
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -54,6 +70,8 @@ jobs:
path: build/reports/tests/
compression-level: 9
- run: ./gradlew buildPlugin
env:
GITHUB_TOKEN: ${{ secrets.CODY_GITHUB_TOKEN }}
- run: ./gradlew --stop
- name: Upload the plugin package
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ The plugin works with all JetBrains IDEs, including:
- To search with Sourcegraph, press <kbd>Alt+S</kbd> (<kbd>⌥S</kbd> on Mac).
- To share a link to your code or search through the website, right-click in the editor, and choose an action under
the `Sourcegraph` context menu item.
- To use your private Sourcegraph instance, open `Settings | Tools | Sourcegraph` and enter your URL and access token.
- To use your private Sourcegraph instance, ensure that you are logged in with Cody via your instance URL and access token (please ensure you use an access token during auth).

## Settings

Expand Down
34 changes: 24 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,18 @@ fun download(url: String, output: File) {
}
println("Downloading... $url")
assert(output.parentFile.mkdirs()) { output.parentFile }
Files.copy(URL(url).openStream(), output.toPath())

val githubToken = System.getenv("GITHUB_TOKEN")
if (url.contains("github.com") && !githubToken.isNullOrEmpty()) {
val connection = URL(url).openConnection() as java.net.HttpURLConnection
connection.setRequestProperty("Authorization", "token $githubToken")
connection.setRequestProperty("User-Agent", "Gradle-Build")
connection.instanceFollowRedirects = true
connection.connect()
Files.copy(connection.inputStream, output.toPath())
} else {
Files.copy(URL(url).openStream(), output.toPath())
}
}

fun copyRecursively(input: File, output: File) {
Expand Down Expand Up @@ -383,7 +394,7 @@ tasks {
}
return Paths.get(pathString).toFile()
}
val url = "https://github.com/sourcegraph/cody/archive/$codyCommit.zip"
val url = "https://api.github.com/repos/sourcegraph/cody/zipball/$codyCommit"
val zipFile = githubArchiveCache.resolve("$codyCommit.zip")
download(url, zipFile)
val destination = githubArchiveCache.resolve("cody").resolve("cody-$codyCommit")
Expand Down Expand Up @@ -492,7 +503,7 @@ tasks {

register("copyProtocol") { copyProtocol() }
register("buildCodeSearch") { buildCodeSearch() }
register("buildCody") { buildCody() }
register("buildCody") { doLast { buildCody() } }

processResources { dependsOn(":buildCodeSearch") }

Expand All @@ -508,13 +519,16 @@ tasks {
buildPlugin {
dependsOn(project.tasks.getByPath("buildCody"))
composedJar.get().exclude("com/intellij/codeInsight/inline/completion/**")
from(
fileTree(buildCodyDir) {
include("*")
include("webviews/**")
},
) {
into("agent/")

doFirst {
from(
fileTree(buildCodyDir) {
include("*")
include("webviews/**")
},
) {
into("agent/")
}
}

doLast {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ org.gradle.jvmargs=-Xmx4g -Xms500m
nodeBinaries.commit=8755ae4c05fd476cd23f2972049111ba436c86d4
nodeBinaries.version=v20.12.2
cody.autocomplete.enableFormatting=true
cody.commit=bb818530bd1200f6a1b26977d9f51ca38c04b3c1
cody.commit=746c7172772dba3a73796842ebc87c0538235d85
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

typealias ApiVersionId = String // One of:

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Attribution_SearchParams(
val id: String,
val snippet: String,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Attribution_SearchResult(
val error: String? = null,
val repoNames: List<String>,
val limitHit: Boolean,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class AutocompleteItem(
val id: String,
val insertText: String,
val range: Range,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

import com.google.gson.annotations.SerializedName;

data class AutocompleteParams(
val uri: String,
val filePath: String? = null,
val position: Position,
val triggerKind: TriggerKindEnum? = null, // Oneof: Automatic, Invoke
val selectedCompletionInfo: SelectedCompletionInfo? = null,
) {

enum class TriggerKindEnum {
@SerializedName("Automatic") Automatic,
@SerializedName("Invoke") Invoke,
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class AutocompleteResult(
val items: List<AutocompleteItem>,
val completionEvent: CompletionBookkeepingEvent? = null,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class BillingMetadataParams(
val product: String,
val category: String,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class CancelParams(
val id: String,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

import com.google.gson.annotations.SerializedName;

data class ChatError(
val kind: String? = null,
val name: String,
val message: String,
val retryAfter: String? = null,
val limit: Long? = null,
val userMessage: String? = null,
val retryAfterDate: Date? = null,
val retryAfterDateString: String? = null,
val retryMessage: String? = null,
val feature: String? = null,
val upgradeIsAvailable: Boolean? = null,
val isChatErrorGuard: IsChatErrorGuardEnum, // Oneof: isChatErrorGuard
) {

enum class IsChatErrorGuardEnum {
@SerializedName("isChatErrorGuard") IsChatErrorGuard,
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class ChatExportResult(
val chatID: String,
val transcript: SerializedChatTranscript,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Chat_DeleteParams(
val chatId: String,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Chat_ExportParams(
val fullHistory: Boolean,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Chat_ImportParams(
val history: Map<String, Map<String, SerializedChatTranscript>>,
val merge: Boolean,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Chat_ModelsParams(
val modelUsage: ModelUsage, // Oneof: chat, edit, autocomplete
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Chat_ModelsResult(
val models: List<ModelAvailabilityStatus>,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Chat_SetModelParams(
val id: String,
val model: String,
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Generated file - DO NOT EDIT MANUALLY
* They are copied from the cody agent project using the copyProtocol gradle task.
* This is only a temporary solution before we fully migrate to generated protocol messages.
*/
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")
package com.sourcegraph.cody.agent.protocol_generated;

data class Chat_Sidebar_NewResult(
val panelId: String,
val chatId: String,
)

Loading
Loading