From e2b72c061889460bcd678af100c54b4204cfec91 Mon Sep 17 00:00:00 2001 From: manjaroblack Date: Sat, 16 Aug 2025 09:10:06 -0500 Subject: [PATCH] refactor: simplify Windsurf workflow generation with minimal frontmatter format --- tools/installer/lib/ide-setup.js | 43 ++++++++------------------------ 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/tools/installer/lib/ide-setup.js b/tools/installer/lib/ide-setup.js index 2a0f5a1e..26e9bc17 100644 --- a/tools/installer/lib/ide-setup.js +++ b/tools/installer/lib/ide-setup.js @@ -235,10 +235,10 @@ class IdeSetup extends BaseIdeSetup { } async setupWindsurf(installDir, selectedAgent) { - const windsurfRulesDir = path.join(installDir, '.windsurf', 'workflows'); + const windsurfWorkflowDir = path.join(installDir, '.windsurf', 'workflows'); const agents = selectedAgent ? [selectedAgent] : await this.getAllAgentIds(installDir); - await fileManager.ensureDirectory(windsurfRulesDir); + await fileManager.ensureDirectory(windsurfWorkflowDir); for (const agentId of agents) { // Find the agent file @@ -246,42 +246,21 @@ class IdeSetup extends BaseIdeSetup { if (agentPath) { const agentContent = await fileManager.readFile(agentPath); - const mdPath = path.join(windsurfRulesDir, `${agentId}.md`); + const mdPath = path.join(windsurfWorkflowDir, `${agentId}.md`); - // Create MD content (similar to Cursor but without frontmatter) - let mdContent = `# ${agentId.toUpperCase()} Agent Rule\n\n`; - mdContent += `This rule is triggered when the user types \`@${agentId}\` and activates the ${await this.getAgentTitle( - agentId, - installDir, - )} agent persona.\n\n`; - mdContent += '## Agent Activation\n\n'; - mdContent += - 'CRITICAL: Read the full YAML, start activation to alter your state of being, follow startup section instructions, stay in this being until told to exit this mode:\n\n'; - mdContent += '```yaml\n'; - // Extract just the YAML content from the agent file - const yamlContent = extractYamlFromAgent(agentContent); - if (yamlContent) { - mdContent += yamlContent; - } else { - // If no YAML found, include the whole content minus the header - mdContent += agentContent.replace(/^#.*$/m, '').trim(); - } - mdContent += '\n```\n\n'; - mdContent += '## File Reference\n\n'; - const relativePath = path.relative(installDir, agentPath).replaceAll('\\', '/'); - mdContent += `The complete agent definition is available in [${relativePath}](${relativePath}).\n\n`; - mdContent += '## Usage\n\n'; - mdContent += `When the user types \`@${agentId}\`, activate this ${await this.getAgentTitle( - agentId, - installDir, - )} persona and follow all instructions defined in the YAML configuration above.\n`; + // Write the agent file contents prefixed with Windsurf frontmatter + let mdContent = `---\n`; + mdContent += `description: ${agentId}\n`; + mdContent += `auto_execution_mode: 3\n`; + mdContent += `---\n\n`; + mdContent += agentContent; await fileManager.writeFile(mdPath, mdContent); - console.log(chalk.green(`āœ“ Created rule: ${agentId}.md`)); + console.log(chalk.green(`āœ“ Created workflow: ${agentId}.md`)); } } - console.log(chalk.green(`\nāœ“ Created Windsurf rules in ${windsurfRulesDir}`)); + console.log(chalk.green(`\nāœ“ Created Windsurf workflows in ${windsurfWorkflowDir}`)); return true; }