mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 14:16:28 +03:00
Major changes: - Consolidate 8 design skills into single frontend-design skill with 7 reference files - Add source/patterns.md as single source of truth for patterns/antipatterns - Patterns are merged into skill during build, served via API for website - Website now dynamically renders both "What TO Do" and "What NOT to Do" sections - Update build system to handle directory-based skills with references - Add /api/patterns endpoint to server - Refactor website with new Antidote section layout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
58 lines
2.0 KiB
JavaScript
58 lines
2.0 KiB
JavaScript
import path from 'path';
|
|
import { cleanDir, ensureDir, writeFile } from '../utils.js';
|
|
|
|
/**
|
|
* Cursor Transformer (Downgraded - No Frontmatter/Args)
|
|
*
|
|
* Strips all frontmatter and metadata, outputs body only.
|
|
* Cursor doesn't support arguments or frontmatter.
|
|
* Reference files are inlined into the main skill file.
|
|
*/
|
|
export function transformCursor(commands, skills, distDir, patterns = null) {
|
|
const cursorDir = path.join(distDir, 'cursor');
|
|
const commandsDir = path.join(cursorDir, '.cursor/commands');
|
|
const rulesDir = path.join(cursorDir, '.cursor/rules');
|
|
|
|
cleanDir(cursorDir);
|
|
ensureDir(commandsDir);
|
|
ensureDir(rulesDir);
|
|
|
|
// Commands: Body only (no frontmatter)
|
|
for (const command of commands) {
|
|
const outputPath = path.join(commandsDir, `${command.name}.md`);
|
|
writeFile(outputPath, command.body);
|
|
}
|
|
|
|
// Skills: Body only (with references inlined)
|
|
let refCount = 0;
|
|
for (const skill of skills) {
|
|
let content = skill.body;
|
|
|
|
// Merge patterns body into frontend-design skill (before Domain Reference Files section)
|
|
if (skill.name === 'frontend-design' && patterns && patterns.body) {
|
|
const insertPoint = content.indexOf('---\n\n## Domain Reference Files');
|
|
if (insertPoint > -1) {
|
|
content = content.slice(0, insertPoint) + '\n\n' + patterns.body + '\n\n' + content.slice(insertPoint);
|
|
} else {
|
|
content += '\n\n' + patterns.body;
|
|
}
|
|
}
|
|
|
|
// Inline reference files if they exist
|
|
if (skill.references && skill.references.length > 0) {
|
|
const refSections = skill.references.map(ref => {
|
|
refCount++;
|
|
return `\n\n---\n\n## Reference: ${ref.name}\n\n${ref.content}`;
|
|
});
|
|
content += refSections.join('');
|
|
}
|
|
|
|
const outputPath = path.join(rulesDir, `${skill.name}.md`);
|
|
writeFile(outputPath, content);
|
|
}
|
|
|
|
const refInfo = refCount > 0 ? ` (${refCount} refs inlined)` : '';
|
|
console.log(`✓ Cursor: ${commands.length} commands, ${skills.length} skills (downgraded)${refInfo}`);
|
|
}
|
|
|