improv: constants
This commit is contained in:
parent
f1026c6a2c
commit
b553630f2a
4 changed files with 12 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import { IDE, RuleWithSource } from "../..";
|
||||
import { walkDirs } from "../../indexing/walkDir";
|
||||
import { RULES_MARKDOWN_FILENAME } from "../../llm/rules/constants";
|
||||
import { getUriPathBasename } from "../../util/uri";
|
||||
import { convertMarkdownRuleToContinueRule } from "./parseMarkdownRule";
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ export async function loadCodebaseRules(ide: IDE): Promise<{
|
|||
// Filter to just rules.md files
|
||||
const rulesMdFiles = allFiles.filter((file) => {
|
||||
const filename = getUriPathBasename(file);
|
||||
return filename === "rules.md";
|
||||
return filename === RULES_MARKDOWN_FILENAME;
|
||||
});
|
||||
|
||||
// Process each rules.md file
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ import { streamDiffLines } from "./edit/streamDiffLines";
|
|||
import { shouldIgnore } from "./indexing/shouldIgnore";
|
||||
import { walkDirCache } from "./indexing/walkDir";
|
||||
import { LLMLogger } from "./llm/logger";
|
||||
import { RULES_MARKDOWN_FILENAME } from "./llm/rules/constants";
|
||||
import { llmStreamChat } from "./llm/streamChat";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { OnboardingModes } from "./protocol/core";
|
||||
|
|
@ -583,7 +584,7 @@ export class Core {
|
|||
let rulesFileCreated = false;
|
||||
for (const uri of data.uris) {
|
||||
const filename = getUriPathBasename(uri);
|
||||
if (filename === "rules.md") {
|
||||
if (filename === RULES_MARKDOWN_FILENAME) {
|
||||
rulesFileCreated = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -614,7 +615,7 @@ export class Core {
|
|||
let rulesFileDeleted = false;
|
||||
for (const uri of data.uris) {
|
||||
const filename = getUriPathBasename(uri);
|
||||
if (filename === "rules.md") {
|
||||
if (filename === RULES_MARKDOWN_FILENAME) {
|
||||
rulesFileDeleted = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -850,7 +851,7 @@ export class Core {
|
|||
uri.endsWith(".prompt") ||
|
||||
uri.endsWith(SYSTEM_PROMPT_DOT_FILE) ||
|
||||
(uri.includes(".continue") && uri.endsWith(".yaml")) ||
|
||||
uri.endsWith("rules.md")
|
||||
uri.endsWith(RULES_MARKDOWN_FILENAME)
|
||||
) {
|
||||
await this.configHandler.reloadConfig();
|
||||
} else if (
|
||||
|
|
|
|||
4
core/llm/rules/constants.ts
Normal file
4
core/llm/rules/constants.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* The filename used for colocated markdown rules
|
||||
*/
|
||||
export const RULES_MARKDOWN_FILENAME = "rules.md";
|
||||
|
|
@ -8,6 +8,7 @@ import {
|
|||
import { renderChatMessage } from "../../util/messageContent";
|
||||
import { getCleanUriPath } from "../../util/uri";
|
||||
import { extractPathsFromCodeBlocks } from "../utils/extractPathsFromCodeBlocks";
|
||||
import { RULES_MARKDOWN_FILENAME } from "./constants";
|
||||
|
||||
/**
|
||||
* Checks if a path matches any of the provided globs
|
||||
|
|
@ -92,7 +93,7 @@ const isRootLevelRule = (rule: RuleWithSource): boolean => {
|
|||
return (
|
||||
!rule.ruleFile ||
|
||||
rule.ruleFile.startsWith(".continue/") ||
|
||||
rule.ruleFile === ".continue/rules.md"
|
||||
rule.ruleFile === `.continue/${RULES_MARKDOWN_FILENAME}`
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue