feat: globs on rules and block docs

This commit is contained in:
Patrick Erichsen 2025-04-24 17:35:23 -07:00
parent d23523938b
commit 24e22db9d4
33 changed files with 548 additions and 217 deletions

View file

@ -56,7 +56,7 @@ function convertYamlRuleToContinueRule(rule: Rule): RuleWithSource {
return {
source: "rules-block",
rule: rule.rule,
if: rule.if,
globs: rule.globs,
name: rule.name,
};
}

View file

@ -117,7 +117,6 @@ export async function* streamDiffLines({
) as UserChatMessage | ToolResultChatMessage | undefined);
const systemMessage = getSystemMessageWithRules({
currentModel: llm.model,
rules,
userMessage: lastUserMessage,
baseSystemMessage: undefined,

8
core/index.d.ts vendored
View file

@ -1,4 +1,8 @@
import { DataDestination, ModelRole, PromptTemplates } from "@continuedev/config-yaml";
import {
DataDestination,
ModelRole,
PromptTemplates,
} from "@continuedev/config-yaml";
import Parser from "web-tree-sitter";
import { LLMConfigurationStatuses } from "./llm/constants";
import { GetGhTokenArgs } from "./protocol/ide";
@ -1502,7 +1506,7 @@ export interface RuleWithSource {
| "rules-block"
| "json-systemMessage"
| ".continuerules";
if?: string;
globs?: string | string[];
rule: string;
description?: string;
ruleFile?: string;

View file

@ -12,7 +12,7 @@ import { isUserOrToolMsg } from "./messages";
import { getSystemMessageWithRules } from "./rules/getSystemMessageWithRules";
export const DEFAULT_CHAT_SYSTEM_MESSAGE_URL =
"https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L8";
"https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts";
export const DEFAULT_CHAT_SYSTEM_MESSAGE = `\
<important_rules>
@ -58,14 +58,10 @@ export const DEFAULT_CHAT_SYSTEM_MESSAGE = `\
of changes unless the user specifically asks for code only.
</important_rules>`;
const CANCELED_TOOL_CALL_MESSAGE =
"This tool call was cancelled by the user. You should clarify next steps, as they don't wish for you to use this tool.";
export function constructMessages(
history: ChatHistoryItem[],
baseChatSystemMessage: string | undefined,
rules: RuleWithSource[],
modelName: string,
): ChatMessage[] {
const filteredHistory = history.filter(
(item) => item.message.role !== "system",
@ -107,8 +103,8 @@ export function constructMessages(
baseSystemMessage: baseChatSystemMessage ?? DEFAULT_CHAT_SYSTEM_MESSAGE,
rules,
userMessage: lastUserMsg,
currentModel: modelName,
});
if (systemMessage.trim()) {
msgs.unshift({
role: "system",

View file

@ -0,0 +1,201 @@
import { RuleWithSource, UserChatMessage } from "../..";
import { getSystemMessageWithRules } from "./getSystemMessageWithRules";
describe("getSystemMessageWithRules", () => {
const baseSystemMessage = "Base system message";
const tsRule: RuleWithSource = {
name: "TypeScript Rule",
rule: "Follow TypeScript best practices",
globs: "**/*.ts?(x)",
source: "rules-block",
};
// Rule without pattern (always active)
const generalRule: RuleWithSource = {
name: "General Rule",
rule: "Always write clear comments",
source: "rules-block",
};
// Rule with a different pattern
const pythonRule: RuleWithSource = {
name: "Python Rule",
rule: "Follow PEP 8 guidelines",
globs: "**/*.py",
source: "rules-block",
};
it("should not include pattern-matched rules when no file paths are mentioned", () => {
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage: undefined,
rules: [tsRule],
});
expect(result).toBe(baseSystemMessage);
});
it("should include general rules (without matches) regardless of file paths", () => {
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage: undefined,
rules: [generalRule],
});
expect(result).toBe(`${baseSystemMessage}\n\n${generalRule.rule}`);
});
it("should include only matching rules based on file paths", () => {
const userMessage: UserChatMessage = {
role: "user",
content:
"```tsx Component.tsx\nexport const Component = () => <div>Hello</div>;\n```",
};
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage,
rules: [tsRule, pythonRule, generalRule],
});
// Should include TS rule and general rule, but not Python rule
const expected = `${baseSystemMessage}\n\n${tsRule.rule}\n\n${generalRule.rule}`;
expect(result).toBe(expected);
});
it("should include multiple matching rules", () => {
const userMessage: UserChatMessage = {
role: "user",
content:
"```tsx Component.tsx\nexport const Component = () => <div>Hello</div>;\n```\n```python test.py\nprint('hello')\n```",
};
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage,
rules: [tsRule, pythonRule, generalRule],
});
// Should include all rules
const expected = `${baseSystemMessage}\n\n${tsRule.rule}\n\n${pythonRule.rule}\n\n${generalRule.rule}`;
expect(result).toBe(expected);
});
it("should include only general rules when no paths match pattern-specific rules", () => {
const userMessage: UserChatMessage = {
role: "user",
content: "```ruby test.rb\nputs 'hello'\n```",
};
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage,
rules: [tsRule, pythonRule, generalRule],
});
// Should only include the general rule
const expected = `${baseSystemMessage}\n\n${generalRule.rule}`;
expect(result).toBe(expected);
});
it("should NOT match with comma-separated glob patterns", () => {
const userMessage: UserChatMessage = {
role: "user",
content:
"```ts src/main.ts\nconsole.log('hello');\n```\n```ts tests/example.test.ts\ntest('should work', () => {});\n```",
};
// Rule with comma-separated glob patterns
const commaRule: RuleWithSource = {
name: "TypeScript Standards",
rule: "Use TypeScript best practices for comma-separated globs",
globs: "src/**/*.ts, tests/**/*.ts",
source: "rules-block",
};
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage,
rules: [commaRule],
});
// With the current implementation, the comma-separated pattern is treated as a single string,
// so it won't match any of the file paths (minimatch doesn't support comma-separated patterns)
expect(result).toBe(baseSystemMessage);
});
it("should match with an array of glob patterns", () => {
const userMessage: UserChatMessage = {
role: "user",
content:
"```ts src/main.ts\nconsole.log('hello');\n```\n```ts tests/example.test.ts\ntest('should work', () => {});\n```\n```ts config/settings.ts\nconst config = {};\n```",
};
// Rule with an array of glob patterns
const arrayGlobRule: RuleWithSource = {
name: "TypeScript Standards",
rule: "Use TypeScript best practices for array globs",
globs: ["src/**/*.ts", "tests/**/*.ts"],
source: "rules-block",
};
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage,
rules: [arrayGlobRule],
});
// With our new implementation, the array of patterns should match both src/main.ts and tests/example.test.ts
expect(result).toBe(`${baseSystemMessage}\n\n${arrayGlobRule.rule}`);
});
it("should match only patterns in the array", () => {
const userMessage: UserChatMessage = {
role: "user",
content:
"```ts src/main.ts\nconsole.log('hello');\n```\n```ts config/settings.ts\nconst config = {};\n```",
};
// Rule with an array of glob patterns
const arrayGlobRule: RuleWithSource = {
name: "TypeScript Standards",
rule: "Use TypeScript best practices for array globs",
globs: ["src/**/*.ts", "tests/**/*.ts"],
source: "rules-block",
};
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage,
rules: [arrayGlobRule],
});
// Should match src/main.ts but not config/settings.ts
expect(result).toBe(`${baseSystemMessage}\n\n${arrayGlobRule.rule}`);
});
it("should not match any when no patterns in the array match", () => {
const userMessage: UserChatMessage = {
role: "user",
content:
"```ts config/settings.ts\nconst config = {};\n```\n```ruby test.rb\nputs 'hello'\n```",
};
// Rule with an array of glob patterns
const arrayGlobRule: RuleWithSource = {
name: "TypeScript Standards",
rule: "Use TypeScript best practices for array globs",
globs: ["src/**/*.ts", "tests/**/*.ts"],
source: "rules-block",
};
const result = getSystemMessageWithRules({
baseSystemMessage,
userMessage,
rules: [arrayGlobRule],
});
// Should not match any file paths
expect(result).toBe(baseSystemMessage);
});
});

View file

@ -1,32 +1,52 @@
import { minimatch } from "minimatch";
import { RuleWithSource, ToolResultChatMessage, UserChatMessage } from "../..";
import { renderChatMessage } from "../../util/messageContent";
import { extractPathsFromCodeBlocks } from "../utils/extractPathsFromCodeBlocks";
import { isRuleActive } from "./isRuleActive";
/**
* Checks if a path matches any of the provided globs
*/
const matchesGlobs = (
path: string,
globs: string | string[] | undefined,
): boolean => {
if (!globs) return true;
if (typeof globs === "string") {
return minimatch(path, globs);
}
if (Array.isArray(globs)) {
return globs.some((glob) => minimatch(path, glob));
}
return false;
};
export const getSystemMessageWithRules = ({
baseSystemMessage,
userMessage,
rules,
currentModel,
}: {
baseSystemMessage?: string;
userMessage: UserChatMessage | ToolResultChatMessage | undefined;
rules: RuleWithSource[];
currentModel: string;
}) => {
const filePathsFromMessage = userMessage
? extractPathsFromCodeBlocks(renderChatMessage(userMessage))
: [];
let systemMessage = baseSystemMessage ?? "";
for (const rule of rules) {
if (
isRuleActive({
rule,
activePaths: filePathsFromMessage,
currentModel,
})
) {
// A rule is active if it has no globs (applies to all files)
// or if at least one file path matches its globs
const hasNoGlobs = !rule.globs;
const matchesAnyFilePath = filePathsFromMessage.some((path) =>
matchesGlobs(path, rule.globs),
);
if (hasNoGlobs || matchesAnyFilePath) {
systemMessage += `\n\n${rule.rule}`;
}
}

View file

@ -1,61 +0,0 @@
import { RuleWithSource } from "../..";
import { isRuleActive } from "./isRuleActive";
describe("isRuleActive", () => {
const rule: RuleWithSource = {
name: "My Rule",
rule: "Do no harm",
if: '${{ contains(current.model.model, "claude-3-7-sonnet") and glob("*.tsx") }}',
source: "rules-block",
};
it("should return false when activePaths is empty", () => {
expect(
isRuleActive({
rule,
activePaths: [],
currentModel: "claude-3-7-sonnet",
}),
).toBe(false);
});
it("should return false when no matching paths exist", () => {
expect(
isRuleActive({
rule,
activePaths: ["test.py", "main.js"],
currentModel: "claude-3-7-sonnet",
}),
).toBe(false);
});
it("should return true when both conditions are met", () => {
expect(
isRuleActive({
rule,
activePaths: ["Component.tsx", "main.js"],
currentModel: "claude-3-7-sonnet",
}),
).toBe(true);
});
it("should return false when only glob matches but model doesn't", () => {
expect(
isRuleActive({
rule,
activePaths: ["Component.tsx"],
currentModel: "gpt-4",
}),
).toBe(false);
});
it("should return false when model matches but glob doesn't", () => {
expect(
isRuleActive({
rule,
activePaths: ["Component.ts"],
currentModel: "claude-3-7-sonnet",
}),
).toBe(false);
});
});

View file

@ -1,64 +0,0 @@
import { compileExpression } from "filtrex";
import { minimatch } from "minimatch";
import { RuleWithSource } from "../..";
const TEMPLATE_VAR_REGEX = /^\$\{\{(\s*.*?\s*)\}\}$/;
const createGlobFunction = (activePaths: string[]) => {
return (pattern: string) => {
const result = activePaths.some((path) => minimatch(path, pattern));
return result;
};
};
const contains = (str: string, searchStr: string): boolean => {
return str.includes(searchStr);
};
const evaluateIf = ({
condition,
activePaths,
currentModel,
}: {
condition: string;
activePaths: string[];
currentModel: string;
}) => {
const expression = condition.match(TEMPLATE_VAR_REGEX)?.[1]?.trim();
if (!expression) {
return true;
}
try {
const evaluate = compileExpression(expression, {
extraFunctions: {
glob: createGlobFunction(activePaths),
contains,
},
constants: {
"current.model.model": currentModel,
},
});
return evaluate({});
} catch (error) {
console.error("Error evaluating rule condition:", error);
return false;
}
};
export const isRuleActive = ({
rule,
activePaths,
currentModel,
}: {
rule: RuleWithSource;
activePaths: string[];
currentModel: string;
}): boolean => {
if (rule.if) {
return evaluateIf({ condition: rule.if, activePaths, currentModel });
}
return true;
};

View file

@ -0,0 +1,21 @@
---
title: Context Blocks
sidebar_label: Context
description: Determine what internal information your AI assistant can access
keywords: [context, blocks, repositories, integration, knowledge base]
sidebar_position: 2
---
These blocks determine what internal information your AI assistant can access:
- **Connect to source repositories** and issues, CI/CD systems, wikis, and knowledge bases
- **Determine the scope** of what the AI can "see" when providing assistance
- **Customize** to match your specific development environment
- **Include proprietary code patterns** unique to your organization
- **Integrate data sources** to connect to any internal system with valuable context
![Context Blocks Overview](/img/context-blocks-overview.png)
## Learn More
Learn more about context providers [here](../reference.md#context), and check out [this guide](../customize/tutorials/build-your-own-context-provider.mdx) to creating your own custom context provider.

20
docs/docs/blocks/data.md Normal file
View file

@ -0,0 +1,20 @@
---
title: Data Blocks
sidebar_label: Data
description: Help organizations capture and analyze AI assistant usage data
keywords: [data, blocks, analytics, metrics, storage, compliance]
sidebar_position: 7
---
These help organizations capture and analyze AI assistant usage data:
- **Analytics Integration**: Export metrics to observability platforms like Splunk or New Relic
- **Cloud Storage**: Store development data in S3/Azure Blob for model fine-tuning and auditing
- **Impact Measurement**: Track acceptance rates and productivity outcomes for ROI calculation
- **Compliance Reporting**: Generate audit trails for security and governance requirements
![Data Blocks Overview](/img/data-blocks-overview.png)
## Learn More
You can read more about development data [here](../customize/deep-dives/development-data.md). Data destinations are configured in the [`data`](../reference.md#data) section of `config.yaml`.

19
docs/docs/blocks/docs.md Normal file
View file

@ -0,0 +1,19 @@
---
title: Docs Blocks
sidebar_label: Docs
description: Bring your documentation directly into the IDE
keywords: [docs, blocks, documentation, guidance, flow]
sidebar_position: 3
---
This is how Continue brings your documentation directly into the IDE:
- **Provide just-in-time guidance** without context switching
- **Reduce support burden** by making information discoverable
- **Keep developers in flow** by eliminating searches through multiple systems
![Docs Blocks Overview](/img/docs-blocks-overview.png)
## Learn More
Learn more in the [@Docs deep dive](../customize/deep-dives/docs.mdx), and view [`docs`](../reference.md#docs) in the YAML Reference for more details.

44
docs/docs/blocks/mcp.md Normal file
View file

@ -0,0 +1,44 @@
---
title: MCP Blocks
---
title: MCP Blocks
sidebar_label: MCP
description: Model Context Protocol servers provide specialized functionality
keywords: [mcp, blocks, model context protocol, integrations, tools]
sidebar_position: 4
---
Model Context Protocol servers provide specialized functionality:
- **Enable integration** with external tools and systems
- **Create extensible interfaces** for custom capabilities
- **Support complex interactions** with your development environment
- **Allow partners** to contribute specialized functionality
- **Connect to databases** to understand schema and data models during development
![MCP Blocks Overview](/img/mcp-blocks-overview.png)
## Learn More
Learn more in the [MCP deep dive](../customize/deep-dives/mcp.mdx), and view [`mcpServers`](../reference.md#mcpservers) in the YAML Reference for more details.
description: Model Context Protocol servers provide specialized functionality
keywords: [mcp, blocks, model context protocol, integrations, tools]
sidebar_position: 4
---
Model Context Protocol servers provide specialized functionality:
- Enable integration with external tools and systems
- Create extensible interfaces for custom capabilities
- Support more complex interactions with your development environment
- Allow partners to contribute specialized functionality
- Database Connectors: Understand schema and data models during development
![MCP Blocks Overview](/img/mcp-blocks-overview.png)
## Learn More
Learn more in the [MCP deep dive](../customize/deep-dives/mcp.mdx), and view [`mcpServers`](../reference.md#mcpservers) in the YAML Reference for more details.

View file

@ -0,0 +1,24 @@
---
title: Model Blocks
sidebar_label: Model
description: Foundation of the entire assistant experience offering specialized capabilities
keywords: [model, blocks, chat, edit, apply, autocomplete, embedding, reranker]
sidebar_position: 1
---
These blocks form the foundation of the entire assistant experience, offering different specialized capabilities:
- **[Chat](../customize/model-roles.md#chat)**: Power conversational interactions about code and provide detailed guidance
- **[Edit](../customize/model-roles.md#edit)**: Handle complex code transformations and refactoring tasks
- **[Apply](../customize/model-roles.md#apply)**: Execute targeted code modifications with high accuracy
- **[Autocomplete](../customize/model-roles.md#autocomplete)**: Provide real-time suggestions as developers type
- **[Embedding](../customize/model-roles.md#embedding)**: Transform code into vector representations for semantic search
- **[Reranker](../customize/model-roles.md#reranker)**: Improve search relevance by ordering results based on semantic meaning
![Model Blocks Overview](/img/model-blocks-overview.png)
## Learn More
Continue supports [many model providers](../customize/model-providers), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have various roles like `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`.
Read more about roles [here](../customize/model-roles) and view [`models`](../reference.md#models) in the YAML Reference.

View file

@ -0,0 +1,21 @@
---
title: Prompt Blocks
sidebar_label: Prompt
description: Specialized instructions that shape how models respond
keywords: [prompts, blocks, instructions, guidance, code review]
sidebar_position: 6
---
These are the specialized instructions that shape how models respond:
- **Define interaction patterns** for specific tasks or frameworks
- **Encode domain expertise** for particular technologies
- **Ensure consistent guidance** aligned with organizational practices
- **Can be shared and reused** across multiple assistants
- **Act as automated code reviewers** that ensure consistency across teams
![Prompt Blocks Overview](/img/prompts-blocks-overview.png)
## Learn More
Prompt blocks have the same syntax as [prompt files](../customize/deep-dives/prompts.md). The `config.yaml` spec for `prompts` can be found [here](../reference.md#prompts).

19
docs/docs/blocks/rules.md Normal file
View file

@ -0,0 +1,19 @@
---
title: Rules Blocks
sidebar_label: Rules
description: Guardrails for your AI coding assistants
keywords: [rules, blocks, standards, practices, guardrails]
sidebar_position: 5
---
Think of these as the guardrails for your AI coding assistants:
- **Enforce company-specific coding standards** and security practices
- **Implement quality checks** that match your engineering culture
- **Create paved paths** for developers to follow organizational best practices
![Rules Blocks Overview](/img/rules-blocks-overview.png)
## Learn More
Learn more in the [rules deep dive](../customize/deep-dives/rules.md), and view [`rules`](../reference.md#rules) in the YAML Reference for more details.

View file

@ -7,7 +7,7 @@ keywords: [rules, .continuerules, system, prompt, message]
Rules are used to provide instructions to the model for [Chat](../../chat/how-to-use-it.md), [Edit](../../edit/how-to-use-it.md), and [Agent](../../agent/how-to-use-it.md) requests.
Rules are **_NOT_** included in most other requests, such as [autocomplete](./autocomplete.mdx) or [apply](../model-roles/apply.mdx).
Rules are not included in most other requests, such as [autocomplete](./autocomplete.mdx) or [apply](../model-roles/apply.mdx).
You can view the current rules by clicking the pen icon above the main toolbar:
@ -25,22 +25,31 @@ When in Agent mode, you can simply prompt the agent to create a rule for you.
For example, you can say "Create a rule for this", and a rule will be created for you in `~/.continue/rules` based on your conversation.
:::
### Syntax
Rules blocks can be simple text, or have the following properties:
- `name` (**required**): A display name/title for the rule
- `rule` (**required**): The text content of the rule
Examples:
- `globs` (optional): When files are provided as context that match this glob pattern, the rule will be included. This can be either a single pattern (e.g., `"**/*.{ts,tsx}"`) or an array of patterns (e.g., `["src/**/*.ts", "tests/**/*.ts"]`).
```yaml title="config.yaml"
rules:
- Always annotate Python functions with their parameter and return types
- name: TypeScript best practices
rule: Always use TypeScript interfaces to define shape of objects. Use type aliases sparingly.
globs: "**/*.{ts,tsx}"
- name: TypeScript test patterns
rule: In TypeScript tests, use Jest's describe/it pattern and follow best practices for mocking.
globs:
- "src/**/*.test.ts"
- "tests/**/*.ts"
- uses: myprofile/my-mood-setter
with:
TONE: consise
- Always annotate Python functions with their parameter and return types
- Always write Google style docstrings for functions and classes
- name: Server-side components
rule: When writing Next.js React components, use server-side components where possible instead of client components.
TONE: concise
```
## Chat System Message

View file

@ -32,7 +32,7 @@ Assistants can either explicitly define blocks - see [Properties](#properties) b
### Using Blocks
Hub blocks and assistants are identified with a slug in the format `owner-slug/block-or-assistant-slug`, where an owner can be a user or organization (For example, if you want to use the [OpenAI 4o Model block](https://hub.continue.dev/openai/gpt-4o), your slug would be `openai/gpt-4o`). These blocks are pulled from https://hub.continue.dev.
Hub blocks and assistants are identified with a slug in the format `owner-slug/block-or-assistant-slug`, where an owner can be a user or organization (For example, if you want to use the [OpenAI 4o Model block](https://hub.continue.dev/openai/gpt-4o), your slug would be `openai/gpt-4o`). These blocks are pulled from [https://hub.continue.dev](https://hub.continue.dev).
Blocks can be imported into an assistant by adding a `uses` clause under the block type. This can be alongside other `uses` clauses or explicit blocks of that type.
@ -270,19 +270,25 @@ Explicit rules can either be simple text or an object with the following propert
- `name` (**required**): A display name/title for the rule
- `rule` (**required**): The text content of the rule
<!-- `if` -->
Example
- `globs` (optional): When files are provided as context that match this glob pattern, the rule will be included. This can be either a single pattern (e.g., `"**/*.{ts,tsx}"`) or an array of patterns (e.g., `["src/**/*.ts", "tests/**/*.ts"]`).
```yaml title="config.yaml"
rules:
- Always annotate Python functions with their parameter and return types
- name: TypeScript best practices
rule: Always use TypeScript interfaces to define shape of objects. Use type aliases sparingly.
globs: "**/*.{ts,tsx}"
- name: TypeScript test patterns
rule: In TypeScript tests, use Jest's describe/it pattern and follow best practices for mocking.
globs:
- "src/**/*.test.ts"
- "tests/**/*.ts"
- uses: myprofile/my-mood-setter
with:
TONE: concise
- Always annotate Python functions with their parameter and return types
- Always write Google style docstrings for functions and classes
- name: Server-side components
rule: When writing Next.js React components, use server-side components where possible instead of client components.
```
---

View file

@ -55,6 +55,16 @@ const sidebars = {
},
],
},
{
type: "category",
label: "Blocks",
items: [
{
type: "autogenerated",
dirName: "blocks",
},
],
},
"telemetry",
"troubleshooting",
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
docs/static/img/data-blocks-overview.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
docs/static/img/docs-blocks-overview.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
docs/static/img/mcp-blocks-overview.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "1.1.24",
"version": "1.1.25",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "1.1.24",
"version": "1.1.25",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",

9
gui/package-lock.json generated
View file

@ -4364,9 +4364,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001662",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz",
"integrity": "sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA==",
"version": "1.0.30001715",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001715.tgz",
"integrity": "sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==",
"funding": [
{
"type": "opencollective",
@ -4380,7 +4380,8 @@
"type": "github",
"url": "https://github.com/sponsors/ai"
}
]
],
"license": "CC-BY-4.0"
},
"node_modules/ccount": {
"version": "2.0.1",

View file

@ -24,14 +24,11 @@ export function ErrorSection() {
}`}
>
{error.fatal ? (
<ExclamationCircleIcon className="mr-2 h-5 w-5" />
<ExclamationCircleIcon className="mr-2 mt-1 h-3.5 w-3.5" />
) : (
<ExclamationTriangleIcon className="mr-2 h-5 w-5" />
<ExclamationTriangleIcon className="mr-2 mt-1 h-3.5 w-3.5" />
)}
<p className="m-0 whitespace-pre-wrap">
<strong>{error.fatal ? "Fatal Error:" : "Warning:"}</strong>{" "}
{error.message}
</p>
<p className="m-0 whitespace-pre-wrap text-xs">{error.message}</p>
</li>
))}
</ul>

View file

@ -123,16 +123,16 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
>
{rule.rule}
</span>
{rule.if ? (
{rule.globs ? (
<div
style={{
fontSize: tinyFont,
}}
className="mt-1.5 flex flex-col gap-1"
>
<span className="italic">Applies if</span>
<span className="italic">Applies to files</span>
<code className="line-clamp-1 px-1 py-0.5 text-gray-400">
{rule.if.replace(/\${{|}}/g, "")}
{rule.globs}
</code>
</div>
) : null}

View file

@ -34,7 +34,6 @@ import { ProfileDescription } from "core/config/ConfigHandler";
import { useNavigate } from "react-router-dom";
import { vscCommandCenterInactiveBorder } from "../..";
import { ROUTES } from "../../../util/navigation";
import { ToolTip } from "../../gui/Tooltip";
import { useLump } from "../../mainInput/Lump/LumpContext";
import { useFontSize } from "../../ui/font";
import AssistantIcon from "./AssistantIcon";
@ -113,42 +112,35 @@ const AssistantSelectOption = ({
</span>
</div>
<div className="flex flex-row items-center gap-1">
{!profile.errors?.length ? (
isLocalProfile(profile) ? (
<Cog6ToothIcon
className="text-lightgray h-3 w-3 flex-shrink-0 cursor-pointer"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleConfigure();
}}
/>
) : (
<ArrowTopRightOnSquareIcon
className="text-lightgray h-3 w-3 flex-shrink-0 cursor-pointer"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleConfigure();
}}
/>
)
{profile.errors && profile.errors?.length > 0 && (
<ExclamationTriangleIcon
data-tooltip-id={`${profile.id}-errors-tooltip`}
className="h-3 w-3 flex-shrink-0 cursor-pointer text-red-500"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleClickError();
}}
/>
)}
{isLocalProfile(profile) ? (
<Cog6ToothIcon
className="text-lightgray h-3 w-3 flex-shrink-0 cursor-pointer"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleConfigure();
}}
/>
) : (
<>
<ExclamationTriangleIcon
data-tooltip-id={`${profile.id}-errors-tooltip`}
className="h-3 w-3 flex-shrink-0 cursor-pointer text-red-500"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleClickError();
}}
/>
<ToolTip id={`${profile.id}-errors-tooltip`}>
<div className="font-semibold">Errors</div>
{JSON.stringify(profile.errors, null, 2)}
</ToolTip>
</>
<ArrowTopRightOnSquareIcon
className="text-lightgray h-3 w-3 flex-shrink-0 cursor-pointer"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleConfigure();
}}
/>
)}
</div>
</div>

View file

@ -89,7 +89,6 @@ export const streamResponseThunk = createAsyncThunk<
[...updatedHistory],
selectedChatModel?.baseChatSystemMessage,
state.config.config.rules,
selectedChatModel.model,
);
posthog.capture("step run", {

View file

@ -69,7 +69,6 @@ export const streamResponseAfterToolCall = createAsyncThunk<
[...updatedHistory],
selectedChatModel?.baseChatSystemMessage,
state.config.config.rules,
selectedChatModel.model,
);
unwrapResult(await dispatch(streamNormalInput({ messages })));

View file

@ -35,16 +35,15 @@ const docSchema = z.object({
});
export type DocsConfig = z.infer<typeof docSchema>;
const ruleObjectSchema = z.object({
name: z.string(),
rule: z.string(),
if: z.string().optional(),
globs: z.union([z.string(), z.array(z.string())]).optional(),
});
const ruleSchema = z.union([z.string(), ruleObjectSchema]);
export type Rule = z.infer<typeof ruleSchema>;
export type RuleObject = z.infer<typeof ruleObjectSchema>;
const defaultUsesSchema = z.string();
@ -168,3 +167,59 @@ export const blockSchema = baseConfigYamlSchema.and(
);
export type Block = z.infer<typeof blockSchema>;
export const continueCommandSchema = z.object({
name: z.string(),
description: z.string().optional(),
prompt: z.string(),
placeholders: z.array(z.string()).optional(),
context: z.string().optional(),
contextWindowSize: z.number().optional(),
model: z.string().optional(),
systemMessage: z.string().optional(),
slashCommand: z.string().optional(),
hideFromCommandPalette: z.boolean().optional(),
hideFromSlashCommands: z.boolean().optional(),
mode: z.enum(["insert", "replace", "diff"]).optional(),
addEnhancedContext: z.boolean().optional(),
});
export const languageMarkerSchema = z.object({
language: z.string(),
markers: z.array(z.string()),
});
export const sidebarSchema = z.object({
enabled: z.boolean().optional(),
defaultOpen: z.boolean().optional(),
defaultWidth: z.number().optional(),
showButtonsThreshold: z.number().optional(),
});
const toolSchema = z.object({
name: z.string(),
description: z.string(),
defaultIcon: z.string().optional(),
});
export const autoindentExtensionsSchema = z.array(z.string());
export const configSchema = z.object({
models: z.array(modelSchema).optional(),
defaultModel: z.string().optional(),
defaultRecentMessages: z.number().optional(),
commands: z.array(continueCommandSchema).optional(),
tools: z.array(toolSchema).optional(),
contextProviders: z.array(z.any()).optional(),
langMarkers: z.array(languageMarkerSchema).optional(),
sidebar: sidebarSchema.optional(),
tabAutocompleteModel: z.string().optional(),
rules: z.array(ruleObjectSchema).optional(),
doneWithBannerForever: z.boolean().optional(),
autoindentExtensions: autoindentExtensionsSchema.optional(),
proxy: z.string().optional(),
api_base: z.string().optional(),
api_key: z.string().optional(),
});
export type Config = z.infer<typeof configSchema>;