fix(rules-core): restore .sisyphus/rules discovery with deprecation warning (planned removal v4.3.0)

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:05:09 +09:00
parent 7ffe823fa9
commit 1bab6ec412
3 changed files with 25 additions and 2 deletions
+4 -1
View File
@@ -7,10 +7,11 @@ export const PROJECT_RULE_SUBDIRS = [
[".claude", "rules"],
[".cursor", "rules"],
[".github", "instructions"],
[".sisyphus", "rules"],
] as const;
export const PROJECT_RULE_FILES = [".github/copilot-instructions.md"] as const;
export const OPENCODE_USER_RULE_DIRS = [".omo/rules", ".opencode/rules"] as const;
export const OPENCODE_USER_RULE_DIRS = [".omo/rules", ".opencode/rules", ".sisyphus/rules"] as const;
export const USER_RULE_DIR = ".claude/rules";
export const RULE_EXTENSIONS = [".md", ".mdc"] as const;
export const GITHUB_INSTRUCTIONS_PATTERN = /\.instructions\.md$/;
@@ -24,7 +25,9 @@ export const SOURCE_PRIORITY: ReadonlyMap<RuleSource, number> = new Map([
[".cursor/rules", 2],
[".github/instructions", 3],
[".github/copilot-instructions.md", 4],
[".sisyphus/rules", 5],
["~/.omo/rules", 100],
["~/.opencode/rules", 101],
["~/.claude/rules", 102],
["~/.sisyphus/rules", 103],
]);
+18
View File
@@ -5,6 +5,11 @@ import { GLOBAL_DISTANCE, OPENCODE_USER_RULE_DIRS, PROJECT_RULE_FILES, PROJECT_R
import { sortCandidates } from "./ordering";
import { findRuleFilesRecursive, safeRealpathSync } from "./scanner";
import type { DirectoryScanEntry, FindRuleFilesOptions, RuleFileCandidate, RuleScanCache, RuleSource } from "./types";
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>();
export function findRuleFiles(
projectRoot: string | null,
@@ -62,6 +67,7 @@ function addProjectRuleCandidates(
for (const entry of scanDirectoryWithCache(ruleDir, cache)) {
if (seenRealPaths.has(entry.realPath)) continue;
seenRealPaths.add(entry.realPath);
warnSisyphusRuleDeprecation(source, entry.path);
candidates.push({
path: entry.path,
realPath: entry.realPath,
@@ -115,6 +121,7 @@ function addUserRuleCandidates(
for (const entry of scanDirectoryWithCache(userRuleDir, cache)) {
if (seenRealPaths.has(entry.realPath)) continue;
seenRealPaths.add(entry.realPath);
warnSisyphusRuleDeprecation(source, entry.path);
candidates.push({
path: entry.path,
realPath: entry.realPath,
@@ -136,6 +143,17 @@ function scanDirectoryWithCache(dir: string, cache: RuleScanCache | undefined):
return entries;
}
function warnSisyphusRuleDeprecation(source: RuleSource, path: string): void {
if (!SISYPHUS_LEGACY_RULE_SOURCES.has(source)) return;
const warningKey = dirname(path);
if (warnedSisyphusRuleDirectories.has(warningKey)) return;
warnedSisyphusRuleDirectories.add(warningKey);
log(SISYPHUS_DEPRECATION_MESSAGE, {
event: "rules-sisyphus-deprecated",
path,
});
}
function validFileRealPath(filePath: string): string | null {
if (!existsSync(filePath)) return null;
try {
+3 -1
View File
@@ -27,9 +27,11 @@ export type RuleSource =
| ".cursor/rules"
| ".github/instructions"
| ".github/copilot-instructions.md"
| ".sisyphus/rules"
| "~/.omo/rules"
| "~/.opencode/rules"
| "~/.claude/rules";
| "~/.claude/rules"
| "~/.sisyphus/rules";
export interface MatchResult {
readonly applies: boolean;