Merge pull request #1339 from gsd-build/feat/windsurf-support
feat: add Windsurf runtime support
This commit is contained in:
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -34,6 +34,8 @@ body:
|
|||||||
- Codex
|
- Codex
|
||||||
- Copilot
|
- Copilot
|
||||||
- Antigravity
|
- Antigravity
|
||||||
|
- Cursor
|
||||||
|
- Windsurf
|
||||||
- Multiple (specify in description)
|
- Multiple (specify in description)
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -54,6 +54,8 @@ body:
|
|||||||
- label: Codex
|
- label: Codex
|
||||||
- label: Copilot
|
- label: Copilot
|
||||||
- label: Antigravity
|
- label: Antigravity
|
||||||
|
- label: Cursor
|
||||||
|
- label: Windsurf
|
||||||
- label: All runtimes
|
- label: All runtimes
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
|||||||
276
bin/install.js
276
bin/install.js
@@ -66,6 +66,7 @@ const hasCodex = args.includes('--codex');
|
|||||||
const hasCopilot = args.includes('--copilot');
|
const hasCopilot = args.includes('--copilot');
|
||||||
const hasAntigravity = args.includes('--antigravity');
|
const hasAntigravity = args.includes('--antigravity');
|
||||||
const hasCursor = args.includes('--cursor');
|
const hasCursor = args.includes('--cursor');
|
||||||
|
const hasWindsurf = args.includes('--windsurf');
|
||||||
const hasBoth = args.includes('--both'); // Legacy flag, keeps working
|
const hasBoth = args.includes('--both'); // Legacy flag, keeps working
|
||||||
const hasAll = args.includes('--all');
|
const hasAll = args.includes('--all');
|
||||||
const hasUninstall = args.includes('--uninstall') || args.includes('-u');
|
const hasUninstall = args.includes('--uninstall') || args.includes('-u');
|
||||||
@@ -73,7 +74,7 @@ const hasUninstall = args.includes('--uninstall') || args.includes('-u');
|
|||||||
// Runtime selection - can be set by flags or interactive prompt
|
// Runtime selection - can be set by flags or interactive prompt
|
||||||
let selectedRuntimes = [];
|
let selectedRuntimes = [];
|
||||||
if (hasAll) {
|
if (hasAll) {
|
||||||
selectedRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor'];
|
selectedRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor', 'windsurf'];
|
||||||
} else if (hasBoth) {
|
} else if (hasBoth) {
|
||||||
selectedRuntimes = ['claude', 'opencode'];
|
selectedRuntimes = ['claude', 'opencode'];
|
||||||
} else {
|
} else {
|
||||||
@@ -84,6 +85,7 @@ if (hasAll) {
|
|||||||
if (hasCopilot) selectedRuntimes.push('copilot');
|
if (hasCopilot) selectedRuntimes.push('copilot');
|
||||||
if (hasAntigravity) selectedRuntimes.push('antigravity');
|
if (hasAntigravity) selectedRuntimes.push('antigravity');
|
||||||
if (hasCursor) selectedRuntimes.push('cursor');
|
if (hasCursor) selectedRuntimes.push('cursor');
|
||||||
|
if (hasWindsurf) selectedRuntimes.push('windsurf');
|
||||||
}
|
}
|
||||||
|
|
||||||
// WSL + Windows Node.js detection
|
// WSL + Windows Node.js detection
|
||||||
@@ -128,6 +130,7 @@ function getDirName(runtime) {
|
|||||||
if (runtime === 'codex') return '.codex';
|
if (runtime === 'codex') return '.codex';
|
||||||
if (runtime === 'antigravity') return '.agent';
|
if (runtime === 'antigravity') return '.agent';
|
||||||
if (runtime === 'cursor') return '.cursor';
|
if (runtime === 'cursor') return '.cursor';
|
||||||
|
if (runtime === 'windsurf') return '.windsurf';
|
||||||
return '.claude';
|
return '.claude';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,6 +159,7 @@ function getConfigDirFromHome(runtime, isGlobal) {
|
|||||||
return "'.gemini', 'antigravity'";
|
return "'.gemini', 'antigravity'";
|
||||||
}
|
}
|
||||||
if (runtime === 'cursor') return "'.cursor'";
|
if (runtime === 'cursor') return "'.cursor'";
|
||||||
|
if (runtime === 'windsurf') return "'.windsurf'";
|
||||||
return "'.claude'";
|
return "'.claude'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,6 +257,17 @@ function getGlobalDir(runtime, explicitDir = null) {
|
|||||||
return path.join(os.homedir(), '.cursor');
|
return path.join(os.homedir(), '.cursor');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runtime === 'windsurf') {
|
||||||
|
// Windsurf: --config-dir > WINDSURF_CONFIG_DIR > ~/.windsurf
|
||||||
|
if (explicitDir) {
|
||||||
|
return expandTilde(explicitDir);
|
||||||
|
}
|
||||||
|
if (process.env.WINDSURF_CONFIG_DIR) {
|
||||||
|
return expandTilde(process.env.WINDSURF_CONFIG_DIR);
|
||||||
|
}
|
||||||
|
return path.join(os.homedir(), '.windsurf');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Claude Code: --config-dir > CLAUDE_CONFIG_DIR > ~/.claude
|
// Claude Code: --config-dir > CLAUDE_CONFIG_DIR > ~/.claude
|
||||||
if (explicitDir) {
|
if (explicitDir) {
|
||||||
@@ -274,7 +289,7 @@ const banner = '\n' +
|
|||||||
'\n' +
|
'\n' +
|
||||||
' Get Shit Done ' + dim + 'v' + pkg.version + reset + '\n' +
|
' Get Shit Done ' + dim + 'v' + pkg.version + reset + '\n' +
|
||||||
' A meta-prompting, context engineering and spec-driven\n' +
|
' A meta-prompting, context engineering and spec-driven\n' +
|
||||||
' development system for Claude Code, OpenCode, Gemini, Codex, Copilot, Antigravity, and Cursor by TÂCHES.\n';
|
' development system for Claude Code, OpenCode, Gemini, Codex, Copilot, Antigravity, Cursor, and Windsurf by TÂCHES.\n';
|
||||||
|
|
||||||
// Parse --config-dir argument
|
// Parse --config-dir argument
|
||||||
function parseConfigDirArg() {
|
function parseConfigDirArg() {
|
||||||
@@ -312,7 +327,7 @@ if (hasUninstall) {
|
|||||||
|
|
||||||
// Show help if requested
|
// Show help if requested
|
||||||
if (hasHelp) {
|
if (hasHelp) {
|
||||||
console.log(` ${yellow}Usage:${reset} npx get-shit-done-cc [options]\n\n ${yellow}Options:${reset}\n ${cyan}-g, --global${reset} Install globally (to config directory)\n ${cyan}-l, --local${reset} Install locally (to current directory)\n ${cyan}--claude${reset} Install for Claude Code only\n ${cyan}--opencode${reset} Install for OpenCode only\n ${cyan}--gemini${reset} Install for Gemini only\n ${cyan}--codex${reset} Install for Codex only\n ${cyan}--copilot${reset} Install for Copilot only\n ${cyan}--antigravity${reset} Install for Antigravity only\n ${cyan}--cursor${reset} Install for Cursor only\n ${cyan}--all${reset} Install for all runtimes\n ${cyan}-u, --uninstall${reset} Uninstall GSD (remove all GSD files)\n ${cyan}-c, --config-dir <path>${reset} Specify custom config directory\n ${cyan}-h, --help${reset} Show this help message\n ${cyan}--force-statusline${reset} Replace existing statusline config\n\n ${yellow}Examples:${reset}\n ${dim}# Interactive install (prompts for runtime and location)${reset}\n npx get-shit-done-cc\n\n ${dim}# Install for Claude Code globally${reset}\n npx get-shit-done-cc --claude --global\n\n ${dim}# Install for Gemini globally${reset}\n npx get-shit-done-cc --gemini --global\n\n ${dim}# Install for Codex globally${reset}\n npx get-shit-done-cc --codex --global\n\n ${dim}# Install for Copilot globally${reset}\n npx get-shit-done-cc --copilot --global\n\n ${dim}# Install for Copilot locally${reset}\n npx get-shit-done-cc --copilot --local\n\n ${dim}# Install for Antigravity globally${reset}\n npx get-shit-done-cc --antigravity --global\n\n ${dim}# Install for Antigravity locally${reset}\n npx get-shit-done-cc --antigravity --local\n\n ${dim}# Install for Cursor globally${reset}\n npx get-shit-done-cc --cursor --global\n\n ${dim}# Install for Cursor locally${reset}\n npx get-shit-done-cc --cursor --local\n\n ${dim}# Install for all runtimes globally${reset}\n npx get-shit-done-cc --all --global\n\n ${dim}# Install to custom config directory${reset}\n npx get-shit-done-cc --codex --global --config-dir ~/.codex-work\n\n ${dim}# Install to current project only${reset}\n npx get-shit-done-cc --claude --local\n\n ${dim}# Uninstall GSD from Cursor globally${reset}\n npx get-shit-done-cc --cursor --global --uninstall\n\n ${yellow}Notes:${reset}\n The --config-dir option is useful when you have multiple configurations.\n It takes priority over CLAUDE_CONFIG_DIR / GEMINI_CONFIG_DIR / CODEX_HOME / COPILOT_CONFIG_DIR / ANTIGRAVITY_CONFIG_DIR / CURSOR_CONFIG_DIR environment variables.\n`);
|
console.log(` ${yellow}Usage:${reset} npx get-shit-done-cc [options]\n\n ${yellow}Options:${reset}\n ${cyan}-g, --global${reset} Install globally (to config directory)\n ${cyan}-l, --local${reset} Install locally (to current directory)\n ${cyan}--claude${reset} Install for Claude Code only\n ${cyan}--opencode${reset} Install for OpenCode only\n ${cyan}--gemini${reset} Install for Gemini only\n ${cyan}--codex${reset} Install for Codex only\n ${cyan}--copilot${reset} Install for Copilot only\n ${cyan}--antigravity${reset} Install for Antigravity only\n ${cyan}--cursor${reset} Install for Cursor only\n ${cyan}--windsurf${reset} Install for Windsurf only\n ${cyan}--all${reset} Install for all runtimes\n ${cyan}-u, --uninstall${reset} Uninstall GSD (remove all GSD files)\n ${cyan}-c, --config-dir <path>${reset} Specify custom config directory\n ${cyan}-h, --help${reset} Show this help message\n ${cyan}--force-statusline${reset} Replace existing statusline config\n\n ${yellow}Examples:${reset}\n ${dim}# Interactive install (prompts for runtime and location)${reset}\n npx get-shit-done-cc\n\n ${dim}# Install for Claude Code globally${reset}\n npx get-shit-done-cc --claude --global\n\n ${dim}# Install for Gemini globally${reset}\n npx get-shit-done-cc --gemini --global\n\n ${dim}# Install for Codex globally${reset}\n npx get-shit-done-cc --codex --global\n\n ${dim}# Install for Copilot globally${reset}\n npx get-shit-done-cc --copilot --global\n\n ${dim}# Install for Copilot locally${reset}\n npx get-shit-done-cc --copilot --local\n\n ${dim}# Install for Antigravity globally${reset}\n npx get-shit-done-cc --antigravity --global\n\n ${dim}# Install for Antigravity locally${reset}\n npx get-shit-done-cc --antigravity --local\n\n ${dim}# Install for Cursor globally${reset}\n npx get-shit-done-cc --cursor --global\n\n ${dim}# Install for Cursor locally${reset}\n npx get-shit-done-cc --cursor --local\n\n ${dim}# Install for Windsurf globally${reset}\n npx get-shit-done-cc --windsurf --global\n\n ${dim}# Install for Windsurf locally${reset}\n npx get-shit-done-cc --windsurf --local\n\n ${dim}# Install for all runtimes globally${reset}\n npx get-shit-done-cc --all --global\n\n ${dim}# Install to custom config directory${reset}\n npx get-shit-done-cc --codex --global --config-dir ~/.codex-work\n\n ${dim}# Install to current project only${reset}\n npx get-shit-done-cc --claude --local\n\n ${dim}# Uninstall GSD from Cursor globally${reset}\n npx get-shit-done-cc --cursor --global --uninstall\n\n ${yellow}Notes:${reset}\n The --config-dir option is useful when you have multiple configurations.\n It takes priority over CLAUDE_CONFIG_DIR / GEMINI_CONFIG_DIR / CODEX_HOME / COPILOT_CONFIG_DIR / ANTIGRAVITY_CONFIG_DIR / CURSOR_CONFIG_DIR / WINDSURF_CONFIG_DIR environment variables.\n`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -861,6 +876,124 @@ function convertClaudeAgentToCursorAgent(content) {
|
|||||||
return `${cleanFrontmatter}\n${body}`;
|
return `${cleanFrontmatter}\n${body}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Windsurf converters ---
|
||||||
|
// Windsurf (by Codeium) uses a tool set similar to Cursor (both VS Code-based).
|
||||||
|
// Config lives in .windsurf/ (local) and ~/.windsurf/ (global).
|
||||||
|
|
||||||
|
// Tool name mapping from Claude Code to Windsurf Cascade
|
||||||
|
const claudeToWindsurfTools = {
|
||||||
|
Bash: 'Shell',
|
||||||
|
Edit: 'StrReplace',
|
||||||
|
AskUserQuestion: null, // No direct equivalent — use conversational prompting
|
||||||
|
SlashCommand: null, // No equivalent — skills are auto-discovered
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a Claude Code tool name to Windsurf Cascade format
|
||||||
|
* @returns {string|null} Windsurf tool name, or null if tool should be excluded
|
||||||
|
*/
|
||||||
|
function convertWindsurfToolName(claudeTool) {
|
||||||
|
if (claudeTool in claudeToWindsurfTools) {
|
||||||
|
return claudeToWindsurfTools[claudeTool];
|
||||||
|
}
|
||||||
|
// MCP tools keep their format (Windsurf supports MCP)
|
||||||
|
if (claudeTool.startsWith('mcp__')) {
|
||||||
|
return claudeTool;
|
||||||
|
}
|
||||||
|
// Most tools share the same name (Read, Write, Glob, Grep, Task, WebSearch, WebFetch, TodoWrite)
|
||||||
|
return claudeTool;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertSlashCommandsToWindsurfSkillMentions(content) {
|
||||||
|
// Keep leading "/" for slash commands; only normalize gsd: -> gsd-.
|
||||||
|
return content.replace(/gsd:/gi, 'gsd-');
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertClaudeToWindsurfMarkdown(content) {
|
||||||
|
let converted = convertSlashCommandsToWindsurfSkillMentions(content);
|
||||||
|
// Replace tool name references in body text
|
||||||
|
converted = converted.replace(/\bBash\(/g, 'Shell(');
|
||||||
|
converted = converted.replace(/\bEdit\(/g, 'StrReplace(');
|
||||||
|
converted = converted.replace(/\bAskUserQuestion\b/g, 'conversational prompting');
|
||||||
|
// Replace subagent_type from Claude to Windsurf format
|
||||||
|
converted = converted.replace(/subagent_type="general-purpose"/g, 'subagent_type="generalPurpose"');
|
||||||
|
converted = converted.replace(/\$ARGUMENTS\b/g, '{{GSD_ARGS}}');
|
||||||
|
// Replace project-level Claude conventions with Windsurf equivalents
|
||||||
|
converted = converted.replace(/`\.\/CLAUDE\.md`/g, '`.windsurf/rules/`');
|
||||||
|
converted = converted.replace(/\.\/CLAUDE\.md/g, '.windsurf/rules/');
|
||||||
|
converted = converted.replace(/`CLAUDE\.md`/g, '`.windsurf/rules/`');
|
||||||
|
converted = converted.replace(/\bCLAUDE\.md\b/g, '.windsurf/rules/');
|
||||||
|
converted = converted.replace(/\.claude\/skills\//g, '.windsurf/skills/');
|
||||||
|
// Remove Claude Code-specific bug workarounds before brand replacement
|
||||||
|
converted = converted.replace(/\*\*Known Claude Code bug \(classifyHandoffIfNeeded\):\*\*[^\n]*\n/g, '');
|
||||||
|
converted = converted.replace(/- \*\*classifyHandoffIfNeeded false failure:\*\*[^\n]*\n/g, '');
|
||||||
|
// Replace "Claude Code" brand references with "Windsurf"
|
||||||
|
converted = converted.replace(/\bClaude Code\b/g, 'Windsurf');
|
||||||
|
return converted;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWindsurfSkillAdapterHeader(skillName) {
|
||||||
|
return `<windsurf_skill_adapter>
|
||||||
|
## A. Skill Invocation
|
||||||
|
- This skill is invoked when the user mentions \`${skillName}\` or describes a task matching this skill.
|
||||||
|
- Treat all user text after the skill mention as \`{{GSD_ARGS}}\`.
|
||||||
|
- If no arguments are present, treat \`{{GSD_ARGS}}\` as empty.
|
||||||
|
|
||||||
|
## B. User Prompting
|
||||||
|
When the workflow needs user input, prompt the user conversationally:
|
||||||
|
- Present options as a numbered list in your response text
|
||||||
|
- Ask the user to reply with their choice
|
||||||
|
- For multi-select, ask for comma-separated numbers
|
||||||
|
|
||||||
|
## C. Tool Usage
|
||||||
|
Use these Windsurf tools when executing GSD workflows:
|
||||||
|
- \`Shell\` for running commands (terminal operations)
|
||||||
|
- \`StrReplace\` for editing existing files
|
||||||
|
- \`Read\`, \`Write\`, \`Glob\`, \`Grep\`, \`Task\`, \`WebSearch\`, \`WebFetch\`, \`TodoWrite\` as needed
|
||||||
|
|
||||||
|
## D. Subagent Spawning
|
||||||
|
When the workflow needs to spawn a subagent:
|
||||||
|
- Use \`Task(subagent_type="generalPurpose", ...)\`
|
||||||
|
- The \`model\` parameter maps to Windsurf's model options (e.g., "fast")
|
||||||
|
</windsurf_skill_adapter>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertClaudeCommandToWindsurfSkill(content, skillName) {
|
||||||
|
const converted = convertClaudeToWindsurfMarkdown(content);
|
||||||
|
const { frontmatter, body } = extractFrontmatterAndBody(converted);
|
||||||
|
let description = `Run GSD workflow ${skillName}.`;
|
||||||
|
if (frontmatter) {
|
||||||
|
const maybeDescription = extractFrontmatterField(frontmatter, 'description');
|
||||||
|
if (maybeDescription) {
|
||||||
|
description = maybeDescription;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
description = toSingleLine(description);
|
||||||
|
const shortDescription = description.length > 180 ? `${description.slice(0, 177)}...` : description;
|
||||||
|
const adapter = getWindsurfSkillAdapterHeader(skillName);
|
||||||
|
|
||||||
|
return `---\nname: ${yamlIdentifier(skillName)}\ndescription: ${yamlQuote(shortDescription)}\n---\n\n${adapter}\n\n${body.trimStart()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert Claude Code agent markdown to Windsurf agent format.
|
||||||
|
* Strips frontmatter fields Windsurf doesn't support (color, skills),
|
||||||
|
* converts tool references, and adds a role context header.
|
||||||
|
*/
|
||||||
|
function convertClaudeAgentToWindsurfAgent(content) {
|
||||||
|
let converted = convertClaudeToWindsurfMarkdown(content);
|
||||||
|
|
||||||
|
const { frontmatter, body } = extractFrontmatterAndBody(converted);
|
||||||
|
if (!frontmatter) return converted;
|
||||||
|
|
||||||
|
const name = extractFrontmatterField(frontmatter, 'name') || 'unknown';
|
||||||
|
const description = extractFrontmatterField(frontmatter, 'description') || '';
|
||||||
|
|
||||||
|
const cleanFrontmatter = `---\nname: ${yamlIdentifier(name)}\ndescription: ${yamlQuote(toSingleLine(description))}\n---`;
|
||||||
|
|
||||||
|
return `${cleanFrontmatter}\n${body}`;
|
||||||
|
}
|
||||||
|
|
||||||
function convertSlashCommandsToCodexSkillMentions(content) {
|
function convertSlashCommandsToCodexSkillMentions(content) {
|
||||||
let converted = content.replace(/\/gsd:([a-z0-9-]+)/gi, (_, commandName) => {
|
let converted = content.replace(/\/gsd:([a-z0-9-]+)/gi, (_, commandName) => {
|
||||||
return `$gsd-${String(commandName).toLowerCase()}`;
|
return `$gsd-${String(commandName).toLowerCase()}`;
|
||||||
@@ -2632,6 +2765,63 @@ function copyCommandsAsCursorSkills(srcDir, skillsDir, prefix, pathPrefix, runti
|
|||||||
recurse(srcDir, prefix);
|
recurse(srcDir, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy Claude commands as Windsurf skills — one folder per skill with SKILL.md.
|
||||||
|
* Mirrors copyCommandsAsCursorSkills but uses Windsurf converters.
|
||||||
|
*/
|
||||||
|
function copyCommandsAsWindsurfSkills(srcDir, skillsDir, prefix, pathPrefix, runtime) {
|
||||||
|
if (!fs.existsSync(srcDir)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.mkdirSync(skillsDir, { recursive: true });
|
||||||
|
|
||||||
|
// Remove previous GSD Windsurf skills to avoid stale command skills
|
||||||
|
const existing = fs.readdirSync(skillsDir, { withFileTypes: true });
|
||||||
|
for (const entry of existing) {
|
||||||
|
if (entry.isDirectory() && entry.name.startsWith(`${prefix}-`)) {
|
||||||
|
fs.rmSync(path.join(skillsDir, entry.name), { recursive: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function recurse(currentSrcDir, currentPrefix) {
|
||||||
|
const entries = fs.readdirSync(currentSrcDir, { withFileTypes: true });
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
const srcPath = path.join(currentSrcDir, entry.name);
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
recurse(srcPath, `${currentPrefix}-${entry.name}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!entry.name.endsWith('.md')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseName = entry.name.replace('.md', '');
|
||||||
|
const skillName = `${currentPrefix}-${baseName}`;
|
||||||
|
const skillDir = path.join(skillsDir, skillName);
|
||||||
|
fs.mkdirSync(skillDir, { recursive: true });
|
||||||
|
|
||||||
|
let content = fs.readFileSync(srcPath, 'utf8');
|
||||||
|
const globalClaudeRegex = /~\/\.claude\//g;
|
||||||
|
const globalClaudeHomeRegex = /\$HOME\/\.claude\//g;
|
||||||
|
const localClaudeRegex = /\.\/\.claude\//g;
|
||||||
|
const windsurfDirRegex = /~\/\.windsurf\//g;
|
||||||
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
||||||
|
content = content.replace(globalClaudeHomeRegex, pathPrefix);
|
||||||
|
content = content.replace(localClaudeRegex, `./${getDirName(runtime)}/`);
|
||||||
|
content = content.replace(windsurfDirRegex, pathPrefix);
|
||||||
|
content = processAttribution(content, getCommitAttribution(runtime));
|
||||||
|
content = convertClaudeCommandToWindsurfSkill(content, skillName);
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join(skillDir, 'SKILL.md'), content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recurse(srcDir, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy Claude commands as Copilot skills — one folder per skill with SKILL.md.
|
* Copy Claude commands as Copilot skills — one folder per skill with SKILL.md.
|
||||||
* Applies CONV-01 (structure), CONV-02 (allowed-tools), CONV-06 (paths), CONV-07 (command names).
|
* Applies CONV-01 (structure), CONV-02 (allowed-tools), CONV-06 (paths), CONV-07 (command names).
|
||||||
@@ -2749,6 +2939,7 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime, isCommand
|
|||||||
const isCopilot = runtime === 'copilot';
|
const isCopilot = runtime === 'copilot';
|
||||||
const isAntigravity = runtime === 'antigravity';
|
const isAntigravity = runtime === 'antigravity';
|
||||||
const isCursor = runtime === 'cursor';
|
const isCursor = runtime === 'cursor';
|
||||||
|
const isWindsurf = runtime === 'windsurf';
|
||||||
const dirName = getDirName(runtime);
|
const dirName = getDirName(runtime);
|
||||||
|
|
||||||
// Clean install: remove existing destination to prevent orphaned files
|
// Clean install: remove existing destination to prevent orphaned files
|
||||||
@@ -2808,6 +2999,9 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime, isCommand
|
|||||||
} else if (isCursor) {
|
} else if (isCursor) {
|
||||||
content = convertClaudeToCursorMarkdown(content);
|
content = convertClaudeToCursorMarkdown(content);
|
||||||
fs.writeFileSync(destPath, content);
|
fs.writeFileSync(destPath, content);
|
||||||
|
} else if (isWindsurf) {
|
||||||
|
content = convertClaudeToWindsurfMarkdown(content);
|
||||||
|
fs.writeFileSync(destPath, content);
|
||||||
} else {
|
} else {
|
||||||
fs.writeFileSync(destPath, content);
|
fs.writeFileSync(destPath, content);
|
||||||
}
|
}
|
||||||
@@ -2829,6 +3023,14 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime, isCommand
|
|||||||
jsContent = jsContent.replace(/CLAUDE\.md/g, '.cursor/rules/');
|
jsContent = jsContent.replace(/CLAUDE\.md/g, '.cursor/rules/');
|
||||||
jsContent = jsContent.replace(/\bClaude Code\b/g, 'Cursor');
|
jsContent = jsContent.replace(/\bClaude Code\b/g, 'Cursor');
|
||||||
fs.writeFileSync(destPath, jsContent);
|
fs.writeFileSync(destPath, jsContent);
|
||||||
|
} else if (isWindsurf && (entry.name.endsWith('.cjs') || entry.name.endsWith('.js'))) {
|
||||||
|
// For Windsurf, also convert Claude references in JS/CJS utility scripts
|
||||||
|
let jsContent = fs.readFileSync(srcPath, 'utf8');
|
||||||
|
jsContent = jsContent.replace(/gsd:/gi, 'gsd-');
|
||||||
|
jsContent = jsContent.replace(/\.claude\/skills\//g, '.windsurf/skills/');
|
||||||
|
jsContent = jsContent.replace(/CLAUDE\.md/g, '.windsurf/rules/');
|
||||||
|
jsContent = jsContent.replace(/\bClaude Code\b/g, 'Windsurf');
|
||||||
|
fs.writeFileSync(destPath, jsContent);
|
||||||
} else {
|
} else {
|
||||||
fs.copyFileSync(srcPath, destPath);
|
fs.copyFileSync(srcPath, destPath);
|
||||||
}
|
}
|
||||||
@@ -2922,6 +3124,7 @@ function uninstall(isGlobal, runtime = 'claude') {
|
|||||||
const isCopilot = runtime === 'copilot';
|
const isCopilot = runtime === 'copilot';
|
||||||
const isAntigravity = runtime === 'antigravity';
|
const isAntigravity = runtime === 'antigravity';
|
||||||
const isCursor = runtime === 'cursor';
|
const isCursor = runtime === 'cursor';
|
||||||
|
const isWindsurf = runtime === 'windsurf';
|
||||||
const dirName = getDirName(runtime);
|
const dirName = getDirName(runtime);
|
||||||
|
|
||||||
// Get the target directory based on runtime and install type
|
// Get the target directory based on runtime and install type
|
||||||
@@ -2940,6 +3143,7 @@ function uninstall(isGlobal, runtime = 'claude') {
|
|||||||
if (runtime === 'copilot') runtimeLabel = 'Copilot';
|
if (runtime === 'copilot') runtimeLabel = 'Copilot';
|
||||||
if (runtime === 'antigravity') runtimeLabel = 'Antigravity';
|
if (runtime === 'antigravity') runtimeLabel = 'Antigravity';
|
||||||
if (runtime === 'cursor') runtimeLabel = 'Cursor';
|
if (runtime === 'cursor') runtimeLabel = 'Cursor';
|
||||||
|
if (runtime === 'windsurf') runtimeLabel = 'Windsurf';
|
||||||
|
|
||||||
console.log(` Uninstalling GSD from ${cyan}${runtimeLabel}${reset} at ${cyan}${locationLabel}${reset}\n`);
|
console.log(` Uninstalling GSD from ${cyan}${runtimeLabel}${reset} at ${cyan}${locationLabel}${reset}\n`);
|
||||||
|
|
||||||
@@ -2966,8 +3170,8 @@ function uninstall(isGlobal, runtime = 'claude') {
|
|||||||
}
|
}
|
||||||
console.log(` ${green}✓${reset} Removed GSD commands from command/`);
|
console.log(` ${green}✓${reset} Removed GSD commands from command/`);
|
||||||
}
|
}
|
||||||
} else if (isCodex || isCursor) {
|
} else if (isCodex || isCursor || isWindsurf) {
|
||||||
// Codex/Cursor: remove skills/gsd-*/SKILL.md skill directories
|
// Codex/Cursor/Windsurf: remove skills/gsd-*/SKILL.md skill directories
|
||||||
const skillsDir = path.join(targetDir, 'skills');
|
const skillsDir = path.join(targetDir, 'skills');
|
||||||
if (fs.existsSync(skillsDir)) {
|
if (fs.existsSync(skillsDir)) {
|
||||||
let skillCount = 0;
|
let skillCount = 0;
|
||||||
@@ -3086,6 +3290,23 @@ function uninstall(isGlobal, runtime = 'claude') {
|
|||||||
console.log(` ${green}✓${reset} Removed ${skillCount} Cursor skills`);
|
console.log(` ${green}✓${reset} Removed ${skillCount} Cursor skills`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (isWindsurf) {
|
||||||
|
// Windsurf: remove skills/gsd-*/ directories (same layout as Cursor skills)
|
||||||
|
const skillsDir = path.join(targetDir, 'skills');
|
||||||
|
if (fs.existsSync(skillsDir)) {
|
||||||
|
let skillCount = 0;
|
||||||
|
const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
|
||||||
|
for (const entry of entries) {
|
||||||
|
if (entry.isDirectory() && entry.name.startsWith('gsd-')) {
|
||||||
|
fs.rmSync(path.join(skillsDir, entry.name), { recursive: true });
|
||||||
|
skillCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (skillCount > 0) {
|
||||||
|
removedCount++;
|
||||||
|
console.log(` ${green}✓${reset} Removed ${skillCount} Windsurf skills`);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const gsdCommandsDir = path.join(targetDir, 'commands', 'gsd');
|
const gsdCommandsDir = path.join(targetDir, 'commands', 'gsd');
|
||||||
if (fs.existsSync(gsdCommandsDir)) {
|
if (fs.existsSync(gsdCommandsDir)) {
|
||||||
@@ -3518,6 +3739,7 @@ function writeManifest(configDir, runtime = 'claude') {
|
|||||||
const isCopilot = runtime === 'copilot';
|
const isCopilot = runtime === 'copilot';
|
||||||
const isAntigravity = runtime === 'antigravity';
|
const isAntigravity = runtime === 'antigravity';
|
||||||
const isCursor = runtime === 'cursor';
|
const isCursor = runtime === 'cursor';
|
||||||
|
const isWindsurf = runtime === 'windsurf';
|
||||||
const gsdDir = path.join(configDir, 'get-shit-done');
|
const gsdDir = path.join(configDir, 'get-shit-done');
|
||||||
const commandsDir = path.join(configDir, 'commands', 'gsd');
|
const commandsDir = path.join(configDir, 'commands', 'gsd');
|
||||||
const opencodeCommandDir = path.join(configDir, 'command');
|
const opencodeCommandDir = path.join(configDir, 'command');
|
||||||
@@ -3529,7 +3751,7 @@ function writeManifest(configDir, runtime = 'claude') {
|
|||||||
for (const [rel, hash] of Object.entries(gsdHashes)) {
|
for (const [rel, hash] of Object.entries(gsdHashes)) {
|
||||||
manifest.files['get-shit-done/' + rel] = hash;
|
manifest.files['get-shit-done/' + rel] = hash;
|
||||||
}
|
}
|
||||||
if (!isOpencode && !isCodex && !isCopilot && !isAntigravity && !isCursor && fs.existsSync(commandsDir)) {
|
if (!isOpencode && !isCodex && !isCopilot && !isAntigravity && !isCursor && !isWindsurf && fs.existsSync(commandsDir)) {
|
||||||
const cmdHashes = generateManifest(commandsDir);
|
const cmdHashes = generateManifest(commandsDir);
|
||||||
for (const [rel, hash] of Object.entries(cmdHashes)) {
|
for (const [rel, hash] of Object.entries(cmdHashes)) {
|
||||||
manifest.files['commands/gsd/' + rel] = hash;
|
manifest.files['commands/gsd/' + rel] = hash;
|
||||||
@@ -3542,7 +3764,7 @@ function writeManifest(configDir, runtime = 'claude') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((isCodex || isCopilot || isAntigravity || isCursor) && fs.existsSync(codexSkillsDir)) {
|
if ((isCodex || isCopilot || isAntigravity || isCursor || isWindsurf) && fs.existsSync(codexSkillsDir)) {
|
||||||
for (const skillName of listCodexSkillNames(codexSkillsDir)) {
|
for (const skillName of listCodexSkillNames(codexSkillsDir)) {
|
||||||
const skillRoot = path.join(codexSkillsDir, skillName);
|
const skillRoot = path.join(codexSkillsDir, skillName);
|
||||||
const skillHashes = generateManifest(skillRoot);
|
const skillHashes = generateManifest(skillRoot);
|
||||||
@@ -3656,6 +3878,7 @@ function install(isGlobal, runtime = 'claude') {
|
|||||||
const isCopilot = runtime === 'copilot';
|
const isCopilot = runtime === 'copilot';
|
||||||
const isAntigravity = runtime === 'antigravity';
|
const isAntigravity = runtime === 'antigravity';
|
||||||
const isCursor = runtime === 'cursor';
|
const isCursor = runtime === 'cursor';
|
||||||
|
const isWindsurf = runtime === 'windsurf';
|
||||||
const dirName = getDirName(runtime);
|
const dirName = getDirName(runtime);
|
||||||
const src = path.join(__dirname, '..');
|
const src = path.join(__dirname, '..');
|
||||||
|
|
||||||
@@ -3686,6 +3909,7 @@ function install(isGlobal, runtime = 'claude') {
|
|||||||
if (isCopilot) runtimeLabel = 'Copilot';
|
if (isCopilot) runtimeLabel = 'Copilot';
|
||||||
if (isAntigravity) runtimeLabel = 'Antigravity';
|
if (isAntigravity) runtimeLabel = 'Antigravity';
|
||||||
if (isCursor) runtimeLabel = 'Cursor';
|
if (isCursor) runtimeLabel = 'Cursor';
|
||||||
|
if (isWindsurf) runtimeLabel = 'Windsurf';
|
||||||
|
|
||||||
console.log(` Installing for ${cyan}${runtimeLabel}${reset} to ${cyan}${locationLabel}${reset}\n`);
|
console.log(` Installing for ${cyan}${runtimeLabel}${reset} to ${cyan}${locationLabel}${reset}\n`);
|
||||||
|
|
||||||
@@ -3763,6 +3987,16 @@ function install(isGlobal, runtime = 'claude') {
|
|||||||
} else {
|
} else {
|
||||||
failures.push('skills/gsd-*');
|
failures.push('skills/gsd-*');
|
||||||
}
|
}
|
||||||
|
} else if (isWindsurf) {
|
||||||
|
const skillsDir = path.join(targetDir, 'skills');
|
||||||
|
const gsdSrc = path.join(src, 'commands', 'gsd');
|
||||||
|
copyCommandsAsWindsurfSkills(gsdSrc, skillsDir, 'gsd', pathPrefix, runtime);
|
||||||
|
const installedSkillNames = listCodexSkillNames(skillsDir); // reuse — same dir structure
|
||||||
|
if (installedSkillNames.length > 0) {
|
||||||
|
console.log(` ${green}✓${reset} Installed ${installedSkillNames.length} skills to skills/`);
|
||||||
|
} else {
|
||||||
|
failures.push('skills/gsd-*');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Claude Code & Gemini: nested structure in commands/ directory
|
// Claude Code & Gemini: nested structure in commands/ directory
|
||||||
const commandsDir = path.join(targetDir, 'commands');
|
const commandsDir = path.join(targetDir, 'commands');
|
||||||
@@ -3829,6 +4063,8 @@ function install(isGlobal, runtime = 'claude') {
|
|||||||
content = convertClaudeAgentToAntigravityAgent(content, isGlobal);
|
content = convertClaudeAgentToAntigravityAgent(content, isGlobal);
|
||||||
} else if (isCursor) {
|
} else if (isCursor) {
|
||||||
content = convertClaudeAgentToCursorAgent(content);
|
content = convertClaudeAgentToCursorAgent(content);
|
||||||
|
} else if (isWindsurf) {
|
||||||
|
content = convertClaudeAgentToWindsurfAgent(content);
|
||||||
}
|
}
|
||||||
const destName = isCopilot ? entry.name.replace('.md', '.agent.md') : entry.name;
|
const destName = isCopilot ? entry.name.replace('.md', '.agent.md') : entry.name;
|
||||||
fs.writeFileSync(path.join(agentsDest, destName), content);
|
fs.writeFileSync(path.join(agentsDest, destName), content);
|
||||||
@@ -3862,7 +4098,7 @@ function install(isGlobal, runtime = 'claude') {
|
|||||||
failures.push('VERSION');
|
failures.push('VERSION');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCodex && !isCopilot && !isCursor) {
|
if (!isCodex && !isCopilot && !isCursor && !isWindsurf) {
|
||||||
// Write package.json to force CommonJS mode for GSD scripts
|
// Write package.json to force CommonJS mode for GSD scripts
|
||||||
// Prevents "require is not defined" errors when project has "type": "module"
|
// Prevents "require is not defined" errors when project has "type": "module"
|
||||||
// Node.js walks up looking for package.json - this stops inheritance from project
|
// Node.js walks up looking for package.json - this stops inheritance from project
|
||||||
@@ -4023,6 +4259,11 @@ function install(isGlobal, runtime = 'claude') {
|
|||||||
return { settingsPath: null, settings: null, statuslineCommand: null, runtime };
|
return { settingsPath: null, settings: null, statuslineCommand: null, runtime };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isWindsurf) {
|
||||||
|
// Windsurf uses skills — no config.toml, no settings.json hooks needed
|
||||||
|
return { settingsPath: null, settings: null, statuslineCommand: null, runtime };
|
||||||
|
}
|
||||||
|
|
||||||
// Configure statusline and hooks in settings.json
|
// Configure statusline and hooks in settings.json
|
||||||
// Gemini and Antigravity use AfterTool instead of PostToolUse for post-tool hooks
|
// Gemini and Antigravity use AfterTool instead of PostToolUse for post-tool hooks
|
||||||
const postToolEvent = (runtime === 'gemini' || runtime === 'antigravity') ? 'AfterTool' : 'PostToolUse';
|
const postToolEvent = (runtime === 'gemini' || runtime === 'antigravity') ? 'AfterTool' : 'PostToolUse';
|
||||||
@@ -4157,8 +4398,9 @@ function finishInstall(settingsPath, settings, statuslineCommand, shouldInstallS
|
|||||||
const isCodex = runtime === 'codex';
|
const isCodex = runtime === 'codex';
|
||||||
const isCopilot = runtime === 'copilot';
|
const isCopilot = runtime === 'copilot';
|
||||||
const isCursor = runtime === 'cursor';
|
const isCursor = runtime === 'cursor';
|
||||||
|
const isWindsurf = runtime === 'windsurf';
|
||||||
|
|
||||||
if (shouldInstallStatusline && !isOpencode && !isCodex && !isCopilot && !isCursor) {
|
if (shouldInstallStatusline && !isOpencode && !isCodex && !isCopilot && !isCursor && !isWindsurf) {
|
||||||
settings.statusLine = {
|
settings.statusLine = {
|
||||||
type: 'command',
|
type: 'command',
|
||||||
command: statuslineCommand
|
command: statuslineCommand
|
||||||
@@ -4167,7 +4409,7 @@ function finishInstall(settingsPath, settings, statuslineCommand, shouldInstallS
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write settings when runtime supports settings.json
|
// Write settings when runtime supports settings.json
|
||||||
if (!isCodex && !isCopilot && !isCursor) {
|
if (!isCodex && !isCopilot && !isCursor && !isWindsurf) {
|
||||||
writeSettings(settingsPath, settings);
|
writeSettings(settingsPath, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4295,9 +4537,10 @@ function promptRuntime(callback) {
|
|||||||
'4': 'codex',
|
'4': 'codex',
|
||||||
'5': 'copilot',
|
'5': 'copilot',
|
||||||
'6': 'antigravity',
|
'6': 'antigravity',
|
||||||
'7': 'cursor'
|
'7': 'cursor',
|
||||||
|
'8': 'windsurf'
|
||||||
};
|
};
|
||||||
const allRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor'];
|
const allRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor', 'windsurf'];
|
||||||
|
|
||||||
console.log(` ${yellow}Which runtime(s) would you like to install for?${reset}\n\n ${cyan}1${reset}) Claude Code ${dim}(~/.claude)${reset}
|
console.log(` ${yellow}Which runtime(s) would you like to install for?${reset}\n\n ${cyan}1${reset}) Claude Code ${dim}(~/.claude)${reset}
|
||||||
${cyan}2${reset}) OpenCode ${dim}(~/.config/opencode)${reset} - open source, free models
|
${cyan}2${reset}) OpenCode ${dim}(~/.config/opencode)${reset} - open source, free models
|
||||||
@@ -4306,7 +4549,8 @@ function promptRuntime(callback) {
|
|||||||
${cyan}5${reset}) Copilot ${dim}(~/.copilot)${reset}
|
${cyan}5${reset}) Copilot ${dim}(~/.copilot)${reset}
|
||||||
${cyan}6${reset}) Antigravity ${dim}(~/.gemini/antigravity)${reset}
|
${cyan}6${reset}) Antigravity ${dim}(~/.gemini/antigravity)${reset}
|
||||||
${cyan}7${reset}) Cursor ${dim}(~/.cursor)${reset}
|
${cyan}7${reset}) Cursor ${dim}(~/.cursor)${reset}
|
||||||
${cyan}8${reset}) All
|
${cyan}8${reset}) Windsurf ${dim}(~/.windsurf)${reset}
|
||||||
|
${cyan}9${reset}) All
|
||||||
|
|
||||||
${dim}Select multiple: 1,4,6 or 1 4 6${reset}
|
${dim}Select multiple: 1,4,6 or 1 4 6${reset}
|
||||||
`);
|
`);
|
||||||
@@ -4317,7 +4561,7 @@ function promptRuntime(callback) {
|
|||||||
const input = answer.trim() || '1';
|
const input = answer.trim() || '1';
|
||||||
|
|
||||||
// "All" shortcut
|
// "All" shortcut
|
||||||
if (input === '8') {
|
if (input === '9') {
|
||||||
callback(allRuntimes);
|
callback(allRuntimes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4453,6 +4697,10 @@ if (process.env.GSD_TEST_MODE) {
|
|||||||
convertClaudeCommandToAntigravitySkill,
|
convertClaudeCommandToAntigravitySkill,
|
||||||
convertClaudeAgentToAntigravityAgent,
|
convertClaudeAgentToAntigravityAgent,
|
||||||
copyCommandsAsAntigravitySkills,
|
copyCommandsAsAntigravitySkills,
|
||||||
|
convertClaudeToWindsurfMarkdown,
|
||||||
|
convertClaudeCommandToWindsurfSkill,
|
||||||
|
convertClaudeAgentToWindsurfAgent,
|
||||||
|
copyCommandsAsWindsurfSkills,
|
||||||
writeManifest,
|
writeManifest,
|
||||||
reportLocalPatches,
|
reportLocalPatches,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ const runtimeMap = {
|
|||||||
'4': 'codex',
|
'4': 'codex',
|
||||||
'5': 'copilot',
|
'5': 'copilot',
|
||||||
'6': 'antigravity',
|
'6': 'antigravity',
|
||||||
'7': 'cursor'
|
'7': 'cursor',
|
||||||
|
'8': 'windsurf'
|
||||||
};
|
};
|
||||||
const allRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor'];
|
const allRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor', 'windsurf'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate the parsing logic from promptRuntime without requiring readline.
|
* Simulate the parsing logic from promptRuntime without requiring readline.
|
||||||
@@ -35,7 +36,7 @@ const allRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigr
|
|||||||
function parseRuntimeInput(input) {
|
function parseRuntimeInput(input) {
|
||||||
input = input.trim() || '1';
|
input = input.trim() || '1';
|
||||||
|
|
||||||
if (input === '8') {
|
if (input === '9') {
|
||||||
return allRuntimes;
|
return allRuntimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +74,12 @@ describe('multi-runtime selection parsing', () => {
|
|||||||
assert.deepStrictEqual(parseRuntimeInput('2 , 5'), ['opencode', 'copilot']);
|
assert.deepStrictEqual(parseRuntimeInput('2 , 5'), ['opencode', 'copilot']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('choice 8 returns all runtimes', () => {
|
test('single choice for windsurf', () => {
|
||||||
assert.deepStrictEqual(parseRuntimeInput('8'), allRuntimes);
|
assert.deepStrictEqual(parseRuntimeInput('8'), ['windsurf']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('choice 9 returns all runtimes', () => {
|
||||||
|
assert.deepStrictEqual(parseRuntimeInput('9'), allRuntimes);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('empty input defaults to claude', () => {
|
test('empty input defaults to claude', () => {
|
||||||
@@ -83,13 +88,13 @@ describe('multi-runtime selection parsing', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('invalid choices are ignored, falls back to claude if all invalid', () => {
|
test('invalid choices are ignored, falls back to claude if all invalid', () => {
|
||||||
assert.deepStrictEqual(parseRuntimeInput('9'), ['claude']);
|
assert.deepStrictEqual(parseRuntimeInput('10'), ['claude']);
|
||||||
assert.deepStrictEqual(parseRuntimeInput('0'), ['claude']);
|
assert.deepStrictEqual(parseRuntimeInput('0'), ['claude']);
|
||||||
assert.deepStrictEqual(parseRuntimeInput('abc'), ['claude']);
|
assert.deepStrictEqual(parseRuntimeInput('abc'), ['claude']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('invalid choices mixed with valid are filtered out', () => {
|
test('invalid choices mixed with valid are filtered out', () => {
|
||||||
assert.deepStrictEqual(parseRuntimeInput('1,9,4'), ['claude', 'codex']);
|
assert.deepStrictEqual(parseRuntimeInput('1,10,4'), ['claude', 'codex']);
|
||||||
assert.deepStrictEqual(parseRuntimeInput('abc 3 xyz'), ['gemini']);
|
assert.deepStrictEqual(parseRuntimeInput('abc 3 xyz'), ['gemini']);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -105,7 +110,7 @@ describe('multi-runtime selection parsing', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('install.js source contains multi-select support', () => {
|
describe('install.js source contains multi-select support', () => {
|
||||||
test('runtimeMap is defined with all 7 runtimes', () => {
|
test('runtimeMap is defined with all 8 runtimes', () => {
|
||||||
for (const [key, name] of Object.entries(runtimeMap)) {
|
for (const [key, name] of Object.entries(runtimeMap)) {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
installSrc.includes(`'${key}': '${name}'`),
|
installSrc.includes(`'${key}': '${name}'`),
|
||||||
|
|||||||
138
tests/windsurf-conversion.test.cjs
Normal file
138
tests/windsurf-conversion.test.cjs
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
/**
|
||||||
|
* Windsurf conversion regression tests.
|
||||||
|
*
|
||||||
|
* Ensures Windsurf frontmatter names are emitted as plain identifiers
|
||||||
|
* (without surrounding quotes), so Windsurf does not treat quotes as
|
||||||
|
* literal parts of skill/subagent names.
|
||||||
|
*/
|
||||||
|
|
||||||
|
process.env.GSD_TEST_MODE = '1';
|
||||||
|
|
||||||
|
const { describe, test } = require('node:test');
|
||||||
|
const assert = require('node:assert');
|
||||||
|
|
||||||
|
const {
|
||||||
|
convertClaudeCommandToWindsurfSkill,
|
||||||
|
convertClaudeAgentToWindsurfAgent,
|
||||||
|
convertClaudeToWindsurfMarkdown,
|
||||||
|
} = require('../bin/install.js');
|
||||||
|
|
||||||
|
describe('convertClaudeCommandToWindsurfSkill', () => {
|
||||||
|
test('writes unquoted Windsurf skill name in frontmatter', () => {
|
||||||
|
const input = `---
|
||||||
|
name: quick
|
||||||
|
description: Execute a quick task
|
||||||
|
---
|
||||||
|
|
||||||
|
<objective>
|
||||||
|
Test body
|
||||||
|
</objective>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const result = convertClaudeCommandToWindsurfSkill(input, 'gsd-quick');
|
||||||
|
const nameMatch = result.match(/^name:\s*(.+)$/m);
|
||||||
|
|
||||||
|
assert.ok(nameMatch, 'frontmatter contains name field');
|
||||||
|
assert.strictEqual(nameMatch[1], 'gsd-quick', 'skill name is plain scalar');
|
||||||
|
assert.ok(!result.includes('name: "gsd-quick"'), 'quoted skill name is not emitted');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('preserves slash for slash commands in markdown body', () => {
|
||||||
|
const input = `---
|
||||||
|
name: gsd:plan-phase
|
||||||
|
description: Plan a phase
|
||||||
|
---
|
||||||
|
|
||||||
|
Next:
|
||||||
|
/gsd:execute-phase 17
|
||||||
|
/gsd-help
|
||||||
|
gsd:progress
|
||||||
|
`;
|
||||||
|
|
||||||
|
const result = convertClaudeCommandToWindsurfSkill(input, 'gsd-plan-phase');
|
||||||
|
// Slash commands: /gsd:execute-phase -> /gsd-execute-phase
|
||||||
|
assert.ok(result.includes('/gsd-execute-phase 17'), 'slash command gsd: -> gsd-');
|
||||||
|
assert.ok(result.includes('/gsd-help'), '/gsd-help preserved');
|
||||||
|
assert.ok(result.includes('gsd-progress'), 'bare gsd: -> gsd-');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('includes windsurf_skill_adapter block', () => {
|
||||||
|
const input = `---
|
||||||
|
name: test
|
||||||
|
description: A test skill
|
||||||
|
---
|
||||||
|
|
||||||
|
Body content.
|
||||||
|
`;
|
||||||
|
|
||||||
|
const result = convertClaudeCommandToWindsurfSkill(input, 'gsd-test');
|
||||||
|
assert.ok(result.includes('<windsurf_skill_adapter>'), 'adapter header present');
|
||||||
|
assert.ok(result.includes('</windsurf_skill_adapter>'), 'adapter footer present');
|
||||||
|
assert.ok(result.includes('Shell'), 'Shell tool mentioned');
|
||||||
|
assert.ok(result.includes('StrReplace'), 'StrReplace tool mentioned');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('convertClaudeAgentToWindsurfAgent', () => {
|
||||||
|
test('converts agent frontmatter with unquoted name', () => {
|
||||||
|
const input = `---
|
||||||
|
name: gsd-bugfix
|
||||||
|
description: "Fix bugs automatically"
|
||||||
|
color: blue
|
||||||
|
skills:
|
||||||
|
- debug
|
||||||
|
- test
|
||||||
|
---
|
||||||
|
|
||||||
|
Agent body content.
|
||||||
|
`;
|
||||||
|
|
||||||
|
const result = convertClaudeAgentToWindsurfAgent(input);
|
||||||
|
const nameMatch = result.match(/^name:\s*(.+)$/m);
|
||||||
|
assert.ok(nameMatch, 'name field present');
|
||||||
|
assert.strictEqual(nameMatch[1], 'gsd-bugfix', 'agent name is plain scalar');
|
||||||
|
// Should strip unsupported fields
|
||||||
|
assert.ok(!result.includes('color:'), 'color field stripped');
|
||||||
|
assert.ok(!result.includes('skills:'), 'skills field stripped');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('convertClaudeToWindsurfMarkdown', () => {
|
||||||
|
test('replaces Claude Code brand with Windsurf', () => {
|
||||||
|
const input = 'Claude Code is a great tool for development.';
|
||||||
|
const result = convertClaudeToWindsurfMarkdown(input);
|
||||||
|
assert.ok(result.includes('Windsurf'), 'brand replaced');
|
||||||
|
assert.ok(!result.includes('Claude Code'), 'original brand removed');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('replaces CLAUDE.md with .windsurf/rules/', () => {
|
||||||
|
const input = 'See `CLAUDE.md` for configuration. Also check ./CLAUDE.md file.';
|
||||||
|
const result = convertClaudeToWindsurfMarkdown(input);
|
||||||
|
assert.ok(result.includes('.windsurf/rules/'), 'CLAUDE.md replaced');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('replaces .claude/skills/ with .windsurf/skills/', () => {
|
||||||
|
const input = 'Skills are stored in .claude/skills/ directory.';
|
||||||
|
const result = convertClaudeToWindsurfMarkdown(input);
|
||||||
|
assert.ok(result.includes('.windsurf/skills/'), 'skills path replaced');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('replaces Bash( with Shell( and Edit( with StrReplace(', () => {
|
||||||
|
const input = 'Use Bash(command) and Edit(file) tools.';
|
||||||
|
const result = convertClaudeToWindsurfMarkdown(input);
|
||||||
|
assert.ok(result.includes('Shell('), 'Bash -> Shell');
|
||||||
|
assert.ok(result.includes('StrReplace('), 'Edit -> StrReplace');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('replaces $ARGUMENTS with {{GSD_ARGS}}', () => {
|
||||||
|
const input = 'Pass $ARGUMENTS to the command.';
|
||||||
|
const result = convertClaudeToWindsurfMarkdown(input);
|
||||||
|
assert.ok(result.includes('{{GSD_ARGS}}'), '$ARGUMENTS replaced');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('removes classifyHandoffIfNeeded workarounds', () => {
|
||||||
|
const input = '**Known Claude Code bug (classifyHandoffIfNeeded):** Some workaround text here\nNext line.';
|
||||||
|
const result = convertClaudeToWindsurfMarkdown(input);
|
||||||
|
assert.ok(!result.includes('classifyHandoffIfNeeded'), 'workaround removed');
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user