refactor(rules): delegate injectors to rules-core
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,38 +1,2 @@
|
||||
import type { RuleFileCandidate } from "./types";
|
||||
|
||||
export type DirectoryScanEntry = {
|
||||
path: string;
|
||||
realPath: string;
|
||||
};
|
||||
|
||||
export type RuleScanCache = {
|
||||
get: (key: string) => RuleFileCandidate[] | undefined;
|
||||
set: (key: string, value: RuleFileCandidate[]) => void;
|
||||
getDirScan: (dir: string) => DirectoryScanEntry[] | undefined;
|
||||
setDirScan: (dir: string, entries: DirectoryScanEntry[]) => void;
|
||||
clear: () => void;
|
||||
};
|
||||
|
||||
export function createRuleScanCache(): RuleScanCache {
|
||||
const finalResultCache = new Map<string, RuleFileCandidate[]>();
|
||||
const directoryScanCache = new Map<string, DirectoryScanEntry[]>();
|
||||
|
||||
return {
|
||||
get(key: string): RuleFileCandidate[] | undefined {
|
||||
return finalResultCache.get(key);
|
||||
},
|
||||
set(key: string, value: RuleFileCandidate[]): void {
|
||||
finalResultCache.set(key, value);
|
||||
},
|
||||
getDirScan(dir: string): DirectoryScanEntry[] | undefined {
|
||||
return directoryScanCache.get(dir);
|
||||
},
|
||||
setDirScan(dir: string, entries: DirectoryScanEntry[]): void {
|
||||
directoryScanCache.set(dir, entries);
|
||||
},
|
||||
clear(): void {
|
||||
finalResultCache.clear();
|
||||
directoryScanCache.clear();
|
||||
},
|
||||
};
|
||||
}
|
||||
export { createRuleScanCache } from "@oh-my-opencode/rules-core";
|
||||
export type { DirectoryScanEntry, RuleScanCache } from "@oh-my-opencode/rules-core";
|
||||
|
||||
Reference in New Issue
Block a user