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:
YeonGyu-Kim
2026-05-20 13:19:33 +09:00
parent 53ddc470e3
commit 12aaff28b5
2 changed files with 21 additions and 8 deletions
+11 -1
View File
@@ -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 {