test(rules-core): isolate sisyphus deprecation warning assertion
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -10,6 +10,7 @@ import { log } from "../../../src/shared/logger";
|
||||
const SISYPHUS_DEPRECATION_MESSAGE = "[rules] .sisyphus/rules is deprecated and will be removed in v4.3.0; migrate to .omo/rules";
|
||||
const SISYPHUS_LEGACY_RULE_SOURCES: ReadonlySet<RuleSource> = new Set([".sisyphus/rules", "~/.sisyphus/rules"]);
|
||||
const warnedSisyphusRuleDirectories = new Set<string>();
|
||||
let logSisyphusRuleDeprecation: typeof log = log;
|
||||
|
||||
export function findRuleFiles(
|
||||
projectRoot: string | null,
|
||||
@@ -148,12 +149,21 @@ function warnSisyphusRuleDeprecation(source: RuleSource, path: string): void {
|
||||
const warningKey = dirname(path);
|
||||
if (warnedSisyphusRuleDirectories.has(warningKey)) return;
|
||||
warnedSisyphusRuleDirectories.add(warningKey);
|
||||
log(SISYPHUS_DEPRECATION_MESSAGE, {
|
||||
logSisyphusRuleDeprecation(SISYPHUS_DEPRECATION_MESSAGE, {
|
||||
event: "rules-sisyphus-deprecated",
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
export function _setSisyphusRuleDeprecationLoggerForTesting(logger: typeof log): void {
|
||||
logSisyphusRuleDeprecation = logger;
|
||||
}
|
||||
|
||||
export function _resetSisyphusRuleDeprecationWarningStateForTesting(): void {
|
||||
warnedSisyphusRuleDirectories.clear();
|
||||
logSisyphusRuleDeprecation = log;
|
||||
}
|
||||
|
||||
function validFileRealPath(filePath: string): string | null {
|
||||
if (!existsSync(filePath)) return null;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user