fix(rules-core): fall back to workspace directory when no project root marker is found

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:04:20 +09:00
parent 2c62e7297b
commit 1f9a581e70
4 changed files with 27 additions and 6 deletions
@@ -339,6 +339,7 @@ describe("createRuleInjectionProcessor", () => {
contentHashes: new Set<string>(),
realPaths: new Set<string>([ruleRealPath]),
}),
homedir: () => homeRoot,
});
// when
+4 -1
View File
@@ -137,6 +137,9 @@ export function createRuleInjectionProcessor(deps: {
} = deps;
const matchDecisionCache: MatchDecisionCache = new Map();
const finderOptions: FindRuleFilesOptions = ruleFinderOptions
? { ...ruleFinderOptions, workspaceDirectory }
: { workspaceDirectory };
function getParsedRule(filePath: string, realPath: string): ParsedRule {
try {
@@ -189,7 +192,7 @@ export function createRuleInjectionProcessor(deps: {
projectRoot,
home,
resolved,
ruleFinderOptions,
finderOptions,
ruleScanCache,
);
const toInject: RuleToInject[] = [];