creatrip-agent-rules-builder
Version:
Unified converter for AI coding agent rules across Cursor, Windsurf, and Claude
18 lines (15 loc) • 568 B
text/typescript
export function normalizeContent(content: string): string {
return content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").trim();
}
export function compareContent(source: string, target: string): boolean {
const normalizedSource = normalizeContent(source);
const normalizedTarget = normalizeContent(target);
return normalizedSource === normalizedTarget;
}
export function extractRulesFromMdc(content: string): string {
const parts = content.split("---");
if (parts.length >= 3) {
return parts.slice(2).join("---").trim();
}
return content.trim();
}