Merge pull request #10937 from continuedev/nate/remove-directory-structure
Remove directory structure from system prompt
This commit is contained in:
commit
81f1016fed
2 changed files with 0 additions and 42 deletions
|
|
@ -46,7 +46,6 @@ describe("constructSystemMessage", () => {
|
|||
|
||||
expect(result).toContain("You are an agent in the Continue CLI");
|
||||
expect(result).toContain("<env>");
|
||||
expect(result).toContain('<context name="directoryStructure">');
|
||||
expect(result).toContain('<context name="gitStatus">');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,10 @@ import { execSync } from "child_process";
|
|||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
|
||||
import pkg from "ignore-walk";
|
||||
import { Minimatch } from "minimatch";
|
||||
|
||||
import { processRule } from "./hubLoader.js";
|
||||
import { PermissionMode } from "./permissions/types.js";
|
||||
import { serviceContainer } from "./services/ServiceContainer.js";
|
||||
import { ConfigServiceState, SERVICE_NAMES } from "./services/types.js";
|
||||
const { WalkerSync } = pkg;
|
||||
|
||||
/**
|
||||
* Check if current directory is a git repository
|
||||
|
|
@ -23,39 +19,6 @@ function isGitRepo(): boolean {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get basic directory structure
|
||||
*/
|
||||
function getDirectoryStructure(): string {
|
||||
try {
|
||||
const walker = new WalkerSync({
|
||||
path: process.cwd(),
|
||||
includeEmpty: false,
|
||||
follow: false,
|
||||
ignoreFiles: [".gitignore", ".continueignore", ".customignore"],
|
||||
});
|
||||
|
||||
(walker.ignoreRules as any)[".customignore"] = [
|
||||
new Minimatch(".git/*", {
|
||||
matchBase: true,
|
||||
dot: true,
|
||||
flipNegate: true,
|
||||
nocase: true,
|
||||
}),
|
||||
];
|
||||
|
||||
const files = walker.start().result as string[];
|
||||
|
||||
const filteredFiles = files
|
||||
.slice(0, 500)
|
||||
.map((file: string) => `./${file}`);
|
||||
|
||||
return filteredFiles.join("\n") || "No structure available";
|
||||
} catch {
|
||||
return "Directory structure not available";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get git status
|
||||
*/
|
||||
|
|
@ -89,10 +52,6 @@ Today's date: ${new Date().toISOString().split("T")[0]}
|
|||
|
||||
As you answer the user's questions, you can use the following context:
|
||||
|
||||
<context name="directoryStructure">Below is a snapshot of this project's file structure at the start of the conversation. This snapshot will NOT update during the conversation. It skips over .gitignore patterns.
|
||||
|
||||
${getDirectoryStructure()}
|
||||
</context>
|
||||
<context name="gitStatus">This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.
|
||||
|
||||
${getGitStatus()}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue