feat: Adds .windsurfrules to the init package. It's composed of the 3 rules we currently package, and has been edited to be Windsurf specific. Rules are added in as sections. The init function will search for an existing .windsurfrules document, and if it finds it, it will append to it. Otherwise it will create it.

This commit is contained in:
Eyal Toledano
2025-03-26 21:24:47 -04:00
parent 5b0552fc20
commit dac1ea61e8
5 changed files with 694 additions and 0 deletions

View File

@@ -158,6 +158,9 @@ function copyTemplateFile(templateName, targetPath, replacements = {}) {
case 'README-task-master.md':
sourcePath = path.join(__dirname, '..', 'README-task-master.md');
break;
case 'windsurfrules':
sourcePath = path.join(__dirname, '..', 'assets', '.windsurfrules');
break;
default:
// For other files like env.example, gitignore, etc. that don't have direct equivalents
sourcePath = path.join(__dirname, '..', 'assets', templateName);
@@ -205,6 +208,20 @@ function copyTemplateFile(templateName, targetPath, replacements = {}) {
return;
}
// Handle .windsurfrules - append the entire content
if (filename === '.windsurfrules') {
log('info', `${targetPath} already exists, appending content instead of overwriting...`);
const existingContent = fs.readFileSync(targetPath, 'utf8');
// Add a separator comment before appending our content
const updatedContent = existingContent.trim() +
'\n\n# Added by Task Master - Development Workflow Rules\n\n' +
content;
fs.writeFileSync(targetPath, updatedContent);
log('success', `Updated ${targetPath} with additional rules`);
return;
}
// Handle package.json - merge dependencies
if (filename === 'package.json') {
log('info', `${targetPath} already exists, merging dependencies...`);
@@ -496,6 +513,9 @@ function createProjectStructure(projectName, projectDescription, projectVersion,
// Copy self_improve.mdc
copyTemplateFile('self_improve.mdc', path.join(targetDir, '.cursor', 'rules', 'self_improve.mdc'));
// Copy .windsurfrules
copyTemplateFile('windsurfrules', path.join(targetDir, '.windsurfrules'));
// Copy scripts/dev.js
copyTemplateFile('dev.js', path.join(targetDir, 'scripts', 'dev.js'));