Initial commit

This commit is contained in:
fraqtal
2026-07-12 08:15:46 +00:00
commit ee0fec0691
1397 changed files with 127242 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import { useCaseNameFromFile } from "./_usecase-name.js";
import { featureRootForFile } from "./_manifest-source.js";
/**
* Resolves the rule execution context from an ESLint context object.
* Returns null when the file is not a use-case file or not inside a
* recognised feature package — callers should return {} immediately.
*/
export function resolveRuleContext(context) {
const opts = context.options[0] ?? {};
const repoRoot = opts.repoRoot ?? context.cwd ?? process.cwd();
const filename = context.filename;
const useCaseName = useCaseNameFromFile(filename);
if (!useCaseName) return null;
const featureRoot = featureRootForFile(filename, repoRoot);
if (!featureRoot) return null;
return { useCaseName, featureRoot, repoRoot };
}