/**
 * Cursor Command Adapter
 *
 * Formats commands for Cursor following its frontmatter specification.
 * Cursor uses a different frontmatter format and file naming convention.
 */
import path from 'path';
/**
 * Escapes a string value for safe YAML output.
 * Quotes the string if it contains special YAML characters.
 */
function escapeYamlValue(value) {
    // Check if value needs quoting (contains special YAML characters or starts/ends with whitespace)
    const needsQuoting = /[:\n\r#{}[\],&*!|>'"%@`]|^\s|\s$/.test(value);
    if (needsQuoting) {
        // Use double quotes and escape internal double quotes and backslashes
        const escaped = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
        return `"${escaped}"`;
    }
    return value;
}
/**
 * Cursor adapter for command generation.
 * File path: .cursor/commands/prox-<id>.md
 * Frontmatter: name (as /prox-<id>), id, category, description
 */
export const cursorAdapter = {
    toolId: 'cursor',
    getFilePath(commandId) {
        return path.join('.cursor', 'commands', `prox-${commandId}.md`);
    },
    formatFile(content) {
        return `---
name: /prox-${content.id}
id: prox-${content.id}
category: ${escapeYamlValue(content.category)}
description: ${escapeYamlValue(content.description)}
---

${content.body}
`;
    },
};
//# sourceMappingURL=cursor.js.map