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:
YeonGyu-Kim
2026-05-18 21:19:06 +09:00
parent fb7d47f1b7
commit 4ea29e2c94
11 changed files with 65 additions and 775 deletions
+2 -38
View File
@@ -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";