Curated, product-agnostic snapshot of the post-story-04 tree: demo content deleted, auth-only reference feature, web-next shell, all gates green. Product-specific docs, ADRs 027-029, PRDs/epics/archive, editor library traces, and product naming are curated out; generic template repairs (coverage provider devDeps, root test:coverage script, live lint fixes, root-only release-please) are kept. See TEMPLATE.md for provenance, curation list, and usage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016j8z4VHjedXDTjEDNg7qHK
19 lines
760 B
JavaScript
19 lines
760 B
JavaScript
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 };
|
|
}
|