override ignore pattern when searching for config.yaml (local assistants)
This commit is contained in:
parent
00eb26099f
commit
eba181c92d
2 changed files with 12 additions and 2 deletions
|
|
@ -1,4 +1,9 @@
|
|||
import ignore from "ignore";
|
||||
import { IDE } from "..";
|
||||
import {
|
||||
DEFAULT_IGNORE_DIRS,
|
||||
DEFAULT_IGNORE_FILETYPES,
|
||||
} from "../indexing/ignore";
|
||||
import { walkDir } from "../indexing/walkDir";
|
||||
import { getGlobalAssistantsPath } from "../util/paths";
|
||||
import { localPathToUri } from "../util/pathToUri";
|
||||
|
|
@ -41,7 +46,11 @@ export async function getAssistantFilesFromDir(
|
|||
return [];
|
||||
}
|
||||
|
||||
const uris = await walkDir(dir, ide);
|
||||
const overrideIgnore = ignore()
|
||||
.add(DEFAULT_IGNORE_FILETYPES.filter((t) => t !== "config.yaml"))
|
||||
.add(DEFAULT_IGNORE_DIRS);
|
||||
|
||||
const uris = await walkDir(dir, ide, { overrideIgnore });
|
||||
const assistantFilePaths = uris.filter(
|
||||
(p) => p.endsWith(".yaml") || p.endsWith(".yml"),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
export interface WalkerOptions {
|
||||
onlyDirs?: boolean;
|
||||
returnRelativeUrisPaths?: boolean;
|
||||
overrideIgnore?: Ignore;
|
||||
}
|
||||
|
||||
type Entry = [string, FileType];
|
||||
|
|
@ -46,7 +47,7 @@ class DFSWalker {
|
|||
// walk is a depth-first search implementation
|
||||
public async *walk(): AsyncGenerator<string> {
|
||||
const defaultAndGlobalIgnores = ignore()
|
||||
.add(defaultIgnoreFileAndDir)
|
||||
.add(this.options.overrideIgnore ?? defaultIgnoreFileAndDir)
|
||||
.add(getGlobalContinueIgArray());
|
||||
|
||||
const rootContext: WalkContext = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue