/**
 * Derive the manifest use-case key from a use-case file path.
 *
 * Convention: `packages/<feature>/src/application/use-cases/<kebab-slug>.use-case.ts`
 * → manifest.useCases.<camelCaseSlug>
 *
 * Returns null for non-use-case files.
 */
export function useCaseNameFromFile(filepath) {
  if (!filepath.endsWith(".use-case.ts")) return null;
  if (!filepath.includes("/application/use-cases/") && !filepath.includes("\\application\\use-cases\\")) {
    return null;
  }
  const base = filepath.split(/[\\/]/).pop();
  const slug = base.replace(/\.use-case\.ts$/, "");
  return slug.split("-").map((part, i) => i === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
}
