improv: clean up code
This commit is contained in:
parent
494ecfddf6
commit
c5db90e9fc
3 changed files with 17 additions and 8 deletions
|
|
@ -3,6 +3,7 @@ import {
|
|||
markdownToRule,
|
||||
} from "@continuedev/config-yaml";
|
||||
import { IDE, RuleWithSource } from "../..";
|
||||
import { PROMPTS_DIR_NAME, RULES_DIR_NAME } from "../../promptFiles";
|
||||
import { joinPathsToUri } from "../../util/uri";
|
||||
import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants";
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ export async function loadMarkdownRules(ide: IDE): Promise<{
|
|||
}
|
||||
|
||||
// Load markdown files from both .continue/rules and .continue/prompts
|
||||
const dirsToCheck = ["rules", "prompts"];
|
||||
const dirsToCheck = [RULES_DIR_NAME, PROMPTS_DIR_NAME];
|
||||
|
||||
for (const dirName of dirsToCheck) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
import path from "path";
|
||||
import { DEFAULT_PROMPTS_FOLDER_V1 } from ".";
|
||||
import {
|
||||
DEFAULT_PROMPTS_FOLDER_V1,
|
||||
DEFAULT_PROMPTS_FOLDER_V2,
|
||||
DEFAULT_RULES_FOLDER,
|
||||
RULES_DIR_NAME,
|
||||
} from ".";
|
||||
import { IDE } from "..";
|
||||
import { walkDir } from "../indexing/walkDir";
|
||||
import { getContinueGlobalPath, readAllGlobalPromptFiles } from "../util/paths";
|
||||
import { joinPathsToUri } from "../util/uri";
|
||||
|
||||
export const DEFAULT_PROMPTS_FOLDER_V2 = ".continue/prompts";
|
||||
|
||||
export async function getPromptFilesFromDir(
|
||||
ide: IDE,
|
||||
dir: string,
|
||||
|
|
@ -41,7 +44,7 @@ export async function getAllPromptFiles(
|
|||
const workspaceDirs = await ide.getWorkspaceDirs();
|
||||
let promptFiles: { path: string; content: string }[] = [];
|
||||
|
||||
let dirsToCheck = [DEFAULT_PROMPTS_FOLDER_V2, ".continue/rules"];
|
||||
let dirsToCheck = [DEFAULT_PROMPTS_FOLDER_V2, DEFAULT_RULES_FOLDER];
|
||||
if (checkV1DefaultFolder) {
|
||||
dirsToCheck.push(DEFAULT_PROMPTS_FOLDER_V1);
|
||||
}
|
||||
|
|
@ -60,10 +63,10 @@ export async function getAllPromptFiles(
|
|||
// Also read from ~/.continue/prompts and ~/.continue/rules
|
||||
promptFiles.push(...readAllGlobalPromptFiles());
|
||||
|
||||
const globalRulesPath = readAllGlobalPromptFiles(
|
||||
path.join(getContinueGlobalPath(), "rules"),
|
||||
const promptFilesFromRulesDirectory = readAllGlobalPromptFiles(
|
||||
path.join(getContinueGlobalPath(), RULES_DIR_NAME),
|
||||
);
|
||||
promptFiles.push(...globalRulesPath);
|
||||
promptFiles.push(...promptFilesFromRulesDirectory);
|
||||
|
||||
return await Promise.all(
|
||||
promptFiles.map(async (file) => {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,11 @@ import { ContextProviderName } from "..";
|
|||
|
||||
export const DEFAULT_PROMPTS_FOLDER_V1 = ".prompts";
|
||||
export const DEFAULT_PROMPTS_FOLDER_V2 = ".continue/prompts";
|
||||
export const DEFAULT_RULES_FOLDER = ".continue/rules";
|
||||
|
||||
// Subdirectory names (without .continue/ prefix)
|
||||
export const RULES_DIR_NAME = "rules";
|
||||
export const PROMPTS_DIR_NAME = "prompts";
|
||||
|
||||
export const SUPPORTED_PROMPT_CONTEXT_PROVIDERS: ContextProviderName[] = [
|
||||
"file",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue