Skip to content

Commit 317f6f4

Browse files
committed
Merge branch 'main' into docs-checks
2 parents 20221a5 + c3fe714 commit 317f6f4

File tree

77 files changed

+4588
-2043
lines changed

Some content is hidden

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

77 files changed

+4588
-2043
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
options:
1414
- label: I've tried using the "Ask AI" feature on the [Continue docs site](https://docs.continue.dev/) to see if the docs have an answer
1515
required: false
16-
- label: I believe this is a bug. I'll try to join the [Continue Discord](https://discord.gg/NWtdYexhMs) for questions
16+
- label: I'm not able to find a related conversation on [GitHub discussions](https://github.com/continuedev/continue/discussions) that reports the same bug
1717
required: false
1818
- label: I'm not able to find an [open issue](https://github.com/continuedev/continue/issues?q=is%3Aopen+is%3Aissue) that reports the same bug
1919
required: false

.github/workflows/jetbrains-release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
needs: check_release_name
9696
if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch'
9797
name: Build Plugin
98-
runs-on: macos-13
98+
runs-on: macos-latest
9999
permissions:
100100
contents: write
101101
pull-requests: write
@@ -358,7 +358,7 @@ jobs:
358358
platform: darwin
359359
arch: x64
360360
npm_config_arch: x64
361-
- os: macos-13
361+
- os: macos-latest
362362
platform: darwin
363363
arch: arm64
364364
npm_config_arch: arm64

.github/workflows/main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ jobs:
7373
platform: alpine
7474
arch: x64
7575
npm_config_arch: x64
76-
- os: macos-13
76+
- os: macos-latest
7777
platform: darwin
7878
arch: x64
7979
npm_config_arch: x64
80-
- os: macos-13
80+
- os: macos-latest
8181
platform: darwin
8282
arch: arm64
8383
npm_config_arch: arm64

.github/workflows/preview.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757
platform: alpine
5858
arch: x64
5959
npm_config_arch: x64
60-
- os: macos-13
60+
- os: macos-latest
6161
platform: darwin
6262
arch: x64
6363
npm_config_arch: x64
64-
- os: macos-13
64+
- os: macos-latest
6565
platform: darwin
6666
arch: arm64
6767
npm_config_arch: arm64

core/autocomplete/context/static-context/StaticContextService.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import * as fs from "fs/promises";
21
import path from "path";
32
import { pathToFileURL } from "url";
43
import Parser from "web-tree-sitter";
5-
import { IDE, Position } from "../../..";
4+
import { FileType, IDE, Position } from "../../../";
65
import { localPathOrUriToPath } from "../../../util/pathToUri";
76
import { getFullLanguageName, getQueryForFile } from "../../../util/treeSitter";
87
import {
@@ -353,10 +352,7 @@ export class StaticContextService {
353352
if (foundContents.has(tdLocation.filepath)) {
354353
content = foundContents.get(tdLocation.filepath)!;
355354
} else {
356-
content = await fs.readFile(
357-
localPathOrUriToPath(tdLocation.filepath),
358-
"utf8",
359-
);
355+
content = await this.ide.readFile(tdLocation.filepath);
360356
foundContents.set(tdLocation.filepath, content);
361357
}
362358

@@ -854,24 +850,19 @@ export class StaticContextService {
854850
return skipDirs.includes(dirName) || dirName.startsWith(".");
855851
};
856852

857-
async function scanRecursively(currentPath: string): Promise<void> {
853+
const scanRecursively = async (currentPath: string): Promise<void> => {
858854
try {
859-
const entries = await fs.readdir(currentPath, {
860-
withFileTypes: true,
861-
});
862-
863-
for (const entry of entries) {
864-
const fullPath = localPathOrUriToPath(
865-
path.join(currentPath, entry.name),
866-
);
855+
const currentUri = pathToFileURL(currentPath).toString();
856+
const entries = await this.ide.listDir(currentUri);
857+
for (const [name, fileType] of entries) {
858+
const fullPath = localPathOrUriToPath(path.join(currentPath, name));
867859

868-
if (entry.isDirectory()) {
869-
// Skip common directories that typically don't contain source files
870-
if (!shouldSkipDirectory(entry.name)) {
860+
if (fileType === (2 as FileType.Directory)) {
861+
if (!shouldSkipDirectory(name)) {
871862
await scanRecursively(fullPath);
872863
}
873-
} else if (entry.isFile()) {
874-
const extension = path.extname(entry.name).toLowerCase();
864+
} else if (fileType === (1 as FileType.File)) {
865+
const extension = path.extname(name).toLowerCase();
875866
if (tsExtensions.includes(extension)) {
876867
tsFiles.push(fullPath);
877868
}
@@ -880,7 +871,7 @@ export class StaticContextService {
880871
} catch (error) {
881872
console.error(`Error reading directory ${currentPath}:`, error);
882873
}
883-
}
874+
};
884875

885876
await scanRecursively(dirPath);
886877
return tsFiles;

core/autocomplete/templating/AutocompleteTemplate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const mercuryMultifileFimTemplate: AutocompleteTemplate = {
192192
suffix,
193193
];
194194
}
195-
return [`<|fim_prefix|>${prefix}`, suffix];
195+
return [`${prefix}`, suffix];
196196
}
197197

198198
const relativePaths = getShortestUniqueRelativeUriPaths(

core/config/yaml/models.vitest.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe("llmsFromModelConfig requestOptions merging", () => {
5252
requestOptions: {
5353
timeout: 30000,
5454
headers: {
55-
"User-Agent": "Continue/1.0.0",
55+
"user-agent": "Continue/1.0.0",
5656
},
5757
proxy: "global-proxy",
5858
},
@@ -112,7 +112,7 @@ describe("llmsFromModelConfig requestOptions merging", () => {
112112
expect(llm.requestOptions).toEqual({
113113
timeout: 60000, // model-specific takes precedence
114114
headers: {
115-
"User-Agent": "Continue/1.0.0", // from global request options
115+
"user-agent": "Continue/1.0.0", // from global request options
116116
Authorization: "Bearer token123", // from model
117117
},
118118
proxy: "model-proxy", // model-specific takes precedence
@@ -236,7 +236,7 @@ describe("llmsFromModelConfig requestOptions merging", () => {
236236
expect(llm.requestOptions).toEqual({
237237
timeout: 120000, // model-specific takes precedence
238238
headers: {
239-
"User-Agent": "Continue/1.0.0", // from global request options
239+
"user-agent": "Continue/1.0.0", // from global request options
240240
"X-Custom": "autodetect", // from model
241241
},
242242
proxy: "global-proxy", // from global request options
@@ -302,7 +302,7 @@ describe("llmsFromModelConfig requestOptions merging", () => {
302302
expect(llm.requestOptions).toEqual({
303303
timeout: 90000,
304304
headers: {
305-
"User-Agent": "Continue/1.0.0",
305+
"user-agent": "Continue/1.0.0",
306306
},
307307
proxy: "global-proxy",
308308
});
@@ -345,7 +345,7 @@ describe("llmsFromModelConfig requestOptions merging", () => {
345345
const llm = result[0];
346346

347347
expect(llm.requestOptions?.headers).toEqual({
348-
"User-Agent": "Continue/1.0.0", // from global request options
348+
"user-agent": "Continue/1.0.0", // from global request options
349349
"Cache-Control": "no-cache", // from global request options
350350
Authorization: "Bearer model-token", // from model
351351
Accept: "application/json", // from model (overrides config)

core/index.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ export interface ChatHistoryItem {
513513
toolCallStates?: ToolCallState[];
514514
isGatheringContext?: boolean;
515515
reasoning?: Reasoning;
516-
appliedRules?: RuleWithSource[];
516+
appliedRules?: RuleMetadata[];
517517
conversationSummary?: string;
518518
}
519519

@@ -1868,18 +1868,21 @@ export type RuleSource =
18681868
| ".continuerules"
18691869
| "agentFile";
18701870

1871-
export interface RuleWithSource {
1871+
export interface RuleMetadata {
18721872
name?: string;
18731873
slug?: string;
18741874
source: RuleSource;
18751875
globs?: string | string[];
18761876
regex?: string | string[];
1877-
rule: string;
18781877
description?: string;
18791878
sourceFile?: string;
18801879
alwaysApply?: boolean;
18811880
invokable?: boolean;
18821881
}
1882+
export interface RuleWithSource extends RuleMetadata {
1883+
rule: string;
1884+
}
1885+
18831886
export interface CompleteOnboardingPayload {
18841887
mode: OnboardingModes;
18851888
provider?: string;

core/llm/rules/getSystemMessageWithRules.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { minimatch } from "minimatch";
22
import {
33
ContextItemWithId,
4+
RuleMetadata,
45
RuleWithSource,
56
ToolResultChatMessage,
67
UserChatMessage,
@@ -324,7 +325,7 @@ export const getApplicableRules = (
324325
return applicableRules;
325326
};
326327

327-
export function getRuleId(rule: RuleWithSource): string {
328+
export function getRuleId(rule: RuleMetadata): string {
328329
return rule.slug ?? rule.sourceFile ?? rule.name ?? rule.source;
329330
}
330331

@@ -342,7 +343,7 @@ export const getSystemMessageWithRules = ({
342343
rulePolicies?: RulePolicies;
343344
}): {
344345
systemMessage: string;
345-
appliedRules: RuleWithSource[];
346+
appliedRules: RuleMetadata[];
346347
} => {
347348
const appliedRules = getApplicableRules(
348349
userMessage,
@@ -359,8 +360,10 @@ export const getSystemMessageWithRules = ({
359360
systemMessage += rule.rule;
360361
}
361362

363+
const ruleMetadata = appliedRules.map(({ rule, ...rest }) => rest);
364+
362365
return {
363366
systemMessage,
364-
appliedRules,
367+
appliedRules: ruleMetadata,
365368
};
366369
};

core/llm/rules/rules-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { RuleWithSource } from "../..";
1+
import { RuleMetadata } from "../..";
22
import { getLastNPathParts } from "../../util/uri";
33

4-
export function getRuleDisplayName(rule: RuleWithSource): string {
4+
export function getRuleDisplayName(rule: RuleMetadata): string {
55
if (rule.name) {
66
return rule.name;
77
}
88
return getRuleSourceDisplayName(rule);
99
}
1010

11-
export function getRuleSourceDisplayName(rule: RuleWithSource): string {
11+
export function getRuleSourceDisplayName(rule: RuleMetadata): string {
1212
switch (rule.source) {
1313
case ".continuerules":
1414
return "Project rules";

0 commit comments

Comments
 (0)