From 1bab6ec4126c75b817985ea414956191cfba637b Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Wed, 20 May 2026 13:05:09 +0900 Subject: [PATCH] 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 --- packages/rules-core/src/constants.ts | 5 ++++- packages/rules-core/src/finder.ts | 18 ++++++++++++++++++ packages/rules-core/src/types.ts | 4 +++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/rules-core/src/constants.ts b/packages/rules-core/src/constants.ts index e254b1768..cbe6659e7 100644 --- a/packages/rules-core/src/constants.ts +++ b/packages/rules-core/src/constants.ts @@ -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 = 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], ]); diff --git a/packages/rules-core/src/finder.ts b/packages/rules-core/src/finder.ts index 8c7d58191..1dcd46a92 100644 --- a/packages/rules-core/src/finder.ts +++ b/packages/rules-core/src/finder.ts @@ -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 = new Set([".sisyphus/rules", "~/.sisyphus/rules"]); +const warnedSisyphusRuleDirectories = new Set(); 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 { diff --git a/packages/rules-core/src/types.ts b/packages/rules-core/src/types.ts index 3be7f2baa..07e67972f 100644 --- a/packages/rules-core/src/types.ts +++ b/packages/rules-core/src/types.ts @@ -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;