Skip to content

Commit 713fd16

Browse files
authored
Merge branch 'main' into pe/assistant-unroll-bugfix
2 parents c5286fc + acb4e85 commit 713fd16

File tree

108 files changed

+4047
-1611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+4047
-1611
lines changed

.github/workflows/auto-release.yml

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Create Automatic Release
22

33
on:
4+
push:
5+
branches:
6+
- nate/auto-main-release-draft
47
schedule:
58
- cron: "0 17 * * 1,3,5" # Run at 9am PST (17:00 UTC) on Monday, Wednesday, Friday
69
workflow_dispatch: # Keep manual trigger option
@@ -13,30 +16,13 @@ jobs:
1316

1417
steps:
1518
- uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0 # Important for getting all tags and commits
18-
19-
- name: Get latest tag
20-
id: get_latest_tag
21-
run: |
22-
# Get the latest tag ending in -vscode or default to v1.1.0-vscode if none exists
23-
latest_tag=$(git tag --sort=-creatordate | grep -E "-vscode$" | head -n 1 || echo "v1.1.0-vscode")
24-
echo "Latest tag: $latest_tag"
25-
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV
2619

27-
- name: Generate next version
28-
id: generate_version
20+
- name: Get version from package.json
21+
id: get_version
2922
run: |
30-
# Extract version numbers (handle the -vscode suffix)
31-
version=${LATEST_TAG#v} # Remove v prefix
32-
version=${version%-vscode} # Remove -vscode suffix
33-
IFS='.' read -ra VERSION_PARTS <<< "$version"
34-
35-
# Increment patch version
36-
((VERSION_PARTS[2]++))
37-
38-
# Create new version string with -vscode suffix
39-
new_version="v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}-vscode"
23+
# Read version from package.json and add -vscode suffix
24+
version=$(node -p "require('./extensions/vscode/package.json').version")
25+
new_version="v${version}-vscode"
4026
echo "New version will be: $new_version"
4127
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
4228
@@ -49,7 +35,7 @@ jobs:
4935
--generate-notes \
5036
--title "$NEW_VERSION" \
5137
--draft \
52-
--latest
38+
--latest \
5339
--prerelease
5440
5541
create-jetbrains-release:
@@ -60,29 +46,14 @@ jobs:
6046
steps:
6147
- uses: actions/checkout@v4
6248
with:
63-
fetch-depth: 0 # Important for getting all tags and commits
49+
fetch-depth: 0
6450

65-
- name: Get latest tag
66-
id: get_latest_tag
51+
- name: Get version from gradle.properties
52+
id: get_version
6753
run: |
68-
# Get the latest tag ending in -jetbrains or default to v1.1.0-jetbrains if none exists
69-
latest_tag=$(git tag --sort=-creatordate | grep -E "-jetbrains$" | head -n 1 || echo "v1.1.0-jetbrains")
70-
echo "Latest tag: $latest_tag"
71-
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV
72-
73-
- name: Generate next version
74-
id: generate_version
75-
run: |
76-
# Extract version numbers (handle the -jetbrains suffix)
77-
version=${LATEST_TAG#v} # Remove v prefix
78-
version=${version%-jetbrains} # Remove -jetbrains suffix
79-
IFS='.' read -ra VERSION_PARTS <<< "$version"
80-
81-
# Increment patch version
82-
((VERSION_PARTS[2]++))
83-
84-
# Create new version string with -jetbrains suffix
85-
new_version="v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}-jetbrains"
54+
# Read version from gradle.properties and add -jetbrains suffix
55+
version=$(grep '^pluginVersion=' extensions/intellij/gradle.properties | cut -d'=' -f2)
56+
new_version="v${version}-jetbrains"
8657
echo "New version will be: $new_version"
8758
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
8859
@@ -95,5 +66,5 @@ jobs:
9566
--generate-notes \
9667
--title "$NEW_VERSION" \
9768
--draft \
98-
--latest
69+
--latest \
9970
--prerelease

.github/workflows/jetbrains-release.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,52 @@ jobs:
3737
echo "should_run=false" >> $GITHUB_OUTPUT
3838
fi
3939
40+
bump-version:
41+
runs-on: ubuntu-latest
42+
needs:
43+
- check_release_name
44+
if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true'
45+
permissions:
46+
contents: write
47+
pull-requests: write
48+
steps:
49+
# 0. Setup git
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
53+
- name: Set up Git
54+
run: |
55+
git config --local user.email "[email protected]"
56+
git config --local user.name "GitHub Action"
57+
58+
- name: Create PR branch
59+
run: |
60+
BRANCH_NAME="chore/bump-jetbrains-version-$(date +%Y%m%d-%H%M%S)"
61+
git checkout -b $BRANCH_NAME
62+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
63+
64+
- name: Bump version in gradle.properties
65+
run: |
66+
cd extensions/intelllij
67+
awk '/pluginVersion=/{split($0,a,"="); split(a[2],b,"."); b[3]+=1; printf "%s=%s.%s.%s\n",a[1],b[1],b[2],b[3];next}1' gradle.properties > tmp && mv tmp gradle.properties
68+
rm -rf tmp
69+
NEW_VERSION=$(grep 'pluginVersion=' gradle.properties | cut -d'=' -f2)
70+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
71+
72+
- name: Create Pull Request
73+
uses: peter-evans/create-pull-request@v5
74+
with:
75+
token: ${{ secrets.CI_GITHUB_TOKEN }}
76+
commit-message: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}"
77+
title: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}"
78+
body: |
79+
Automated PR to bump the JetBrains extension version after successful pre-release publication.
80+
81+
- Bumped version in extensions/intellij/gradle.properties to ${{ env.NEW_VERSION }}
82+
branch: ${{ env.BRANCH_NAME }}
83+
base: main
84+
delete-branch: true
85+
4086
# Prepare and publish the plugin to JetBrains Marketplace repository
4187
build:
4288
needs: check_release_name

.github/workflows/pr_checks.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,4 @@ jobs:
632632
- name: Decide whether the needed jobs succeeded or failed
633633
uses: re-actors/alls-green@release/v1
634634
with:
635-
allowed-failures:
636-
allowed-skips:
637635
jobs: ${{ toJSON(needs) }}

.github/workflows/vscode-version-bump.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: VS Code Extension Version Bump
1+
name: Create VS Code main release draft
22
on:
33
schedule:
44
# Runs at 7 AM PST (15:00 UTC) every Friday
@@ -15,6 +15,10 @@ jobs:
1515
with:
1616
fetch-depth: 0 # Fetch all history and tags
1717

18+
- name: Setup GitHub CLI
19+
run: |
20+
gh auth login --with-token <<< "${{ github.token }}"
21+
1822
- name: Use Node.js from .nvmrc
1923
uses: actions/setup-node@v4
2024
with:
@@ -97,6 +101,15 @@ jobs:
97101
echo "Pushing branch to origin..."
98102
git push origin $NEW_BRANCH
99103
104+
# Add release creation
105+
echo "Creating draft release..."
106+
gh release create "${NEW_BRANCH}" \
107+
--title "${NEW_BRANCH}" \
108+
--generate-notes \
109+
--draft \
110+
--latest \
111+
--notes-start-tag "${LAST_1_0_TAG}"
112+
100113
echo "Version bump process completed successfully!"
101114
102115
- name: Check for errors

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.11.0

binary/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
process.env.IS_BINARY = "true";
22
import { Command } from "commander";
33
import { Core } from "core/core";
4+
import { LLMLogFormatter } from "core/llm/logFormatter";
45
import { FromCoreProtocol, ToCoreProtocol } from "core/protocol";
56
import { IMessenger } from "core/protocol/messenger";
67
import { getCoreLogsPath, getPromptLogsPath } from "core/util/paths";
@@ -33,9 +34,8 @@ program.action(async () => {
3334
const ide = new IpcIde(messenger);
3435
const promptLogsPath = getPromptLogsPath();
3536

36-
new Core(messenger, ide, async (text) => {
37-
fs.appendFileSync(promptLogsPath, text + "\n\n");
38-
});
37+
const core = new Core(messenger, ide);
38+
new LLMLogFormatter(core.llmLogger, fs.createWriteStream(promptLogsPath));
3939

4040
console.log("[binary] Core started");
4141
} catch (e) {

core/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@typescript-eslint/semi": "off",
1414
"eqeqeq": "error",
1515
"complexity": ["error", { "max": 38 }],
16-
"max-lines-per-function": ["error", { "max": 996 }],
16+
"max-lines-per-function": ["error", { "max": 485 }],
1717
"max-statements": ["error", { "max": 114 }],
1818
"max-depth": ["error", { "max": 6 }],
1919
"max-nested-callbacks": ["error", { "max": 4 }],

core/autocomplete/util/AutocompleteLruCache.ts

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,52 @@ export class AutocompleteLruCache {
3939
// If the query is "co" and we have "c" -> "ontinue" in the cache,
4040
// we should return "ntinue" as the completion.
4141
// Have to make sure we take the key with shortest length
42-
const result = await this.db.get(
43-
"SELECT key, value FROM cache WHERE ? LIKE key || '%' ORDER BY LENGTH(key) DESC LIMIT 1",
44-
truncateSqliteLikePattern(prefix),
45-
);
46-
47-
// Validate that the cached compeltion is a valid completion for the prefix
48-
if (result && result.value.startsWith(prefix.slice(result.key.length))) {
49-
await this.db.run(
50-
"UPDATE cache SET timestamp = ? WHERE key = ?",
51-
Date.now(),
52-
prefix,
42+
const truncatedPrefix = truncateSqliteLikePattern(prefix);
43+
try {
44+
const result = await this.db.get(
45+
"SELECT key, value FROM cache WHERE ? LIKE key || '%' ORDER BY LENGTH(key) DESC LIMIT 1",
46+
truncatedPrefix,
5347
);
54-
// And then truncate so we aren't writing something that's already there
55-
return result.value.slice(prefix.length - result.key.length);
48+
// Validate that the cached completion is a valid completion for the prefix
49+
if (
50+
result &&
51+
result.value.startsWith(truncatedPrefix.slice(result.key.length))
52+
) {
53+
await this.db.run(
54+
"UPDATE cache SET timestamp = ? WHERE key = ?",
55+
Date.now(),
56+
truncatedPrefix,
57+
);
58+
// And then truncate so we aren't writing something that's already there
59+
return result.value.slice(truncatedPrefix.length - result.key.length);
60+
}
61+
} catch (e) {
62+
// catches e.g. old SQLITE LIKE OR GLOB PATTERN TOO COMPLEX
63+
console.error(e);
5664
}
5765

5866
return undefined;
5967
}
6068

6169
async put(prefix: string, completion: string) {
6270
const release = await this.mutex.acquire();
71+
72+
const truncatedPrefix = truncateSqliteLikePattern(prefix);
6373
try {
6474
await this.db.run("BEGIN TRANSACTION");
6575

6676
try {
6777
const result = await this.db.get(
6878
"SELECT key FROM cache WHERE key = ?",
69-
prefix,
79+
truncatedPrefix,
7080
);
7181

7282
if (result) {
7383
await this.db.run(
7484
"UPDATE cache SET value = ?, timestamp = ? WHERE key = ?",
7585
completion,
7686
Date.now(),
77-
prefix,
87+
truncatedPrefix,
7888
);
7989
} else {
8090
const count = await this.db.get(
@@ -89,7 +99,7 @@ export class AutocompleteLruCache {
8999

90100
await this.db.run(
91101
"INSERT INTO cache (key, value, timestamp) VALUES (?, ?, ?)",
92-
prefix,
102+
truncatedPrefix,
93103
completion,
94104
Date.now(),
95105
);

core/commands/index.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CustomCommand, SlashCommand, SlashCommandDescription } from "../";
22
import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString";
33
import { replaceSlashCommandWithPromptInChatHistory } from "../promptFiles/v1/updateChatHistory";
4+
import { renderPromptFileV2 } from "../promptFiles/v2/renderPromptFile";
45
import { renderChatMessage } from "../util/messageContent";
56

67
import SlashCommands from "./slash";
@@ -15,7 +16,16 @@ export function slashFromCustomCommand(
1516
name: commandName,
1617
description: customCommand.description ?? "",
1718
prompt: customCommand.prompt,
18-
run: async function* ({ input, llm, history, ide, completionOptions }) {
19+
run: async function* ({
20+
input,
21+
llm,
22+
history,
23+
ide,
24+
completionOptions,
25+
config,
26+
selectedCode,
27+
fetch,
28+
}) {
1929
// Render prompt template
2030
let renderedPrompt: string;
2131
if (customCommand.prompt.includes("{{{ input }}}")) {
@@ -25,7 +35,21 @@ export function slashFromCustomCommand(
2535
{ input },
2636
);
2737
} else {
28-
renderedPrompt = customCommand.prompt + "\n\n" + input;
38+
const renderedPromptFile = await renderPromptFileV2(
39+
customCommand.prompt,
40+
{
41+
config,
42+
llm,
43+
ide,
44+
selectedCode,
45+
fetch,
46+
fullInput: input,
47+
embeddingsProvider: config.modelsByRole.embed[0],
48+
reranker: config.modelsByRole.rerank[0],
49+
},
50+
);
51+
52+
renderedPrompt = renderedPromptFile[1];
2953
}
3054

3155
// Replaces slash command messages with the rendered prompt

core/config/ConfigHandler.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { defaultConfig } from "./default";
99

1010
describe.skip("Test the ConfigHandler and E2E config loading", () => {
1111
test("should show only local profile", () => {
12-
const profiles = testConfigHandler.listProfiles();
12+
const profiles = testConfigHandler.currentOrg.profiles;
1313
expect(profiles?.length).toBe(1);
14-
expect(profiles?.[0].id).toBe("local");
14+
expect(profiles?.[0].profileDescription.id).toBe("local");
1515

1616
const currentProfile = testConfigHandler.currentProfile;
1717
expect(currentProfile?.profileDescription.id).toBe("local");

0 commit comments

Comments
 (0)