Merge pull request #1339 from gsd-build/feat/windsurf-support
feat: add Windsurf runtime support
This commit is contained in:
@@ -24,9 +24,10 @@ const runtimeMap = {
|
||||
'4': 'codex',
|
||||
'5': 'copilot',
|
||||
'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.
|
||||
@@ -35,7 +36,7 @@ const allRuntimes = ['claude', 'opencode', 'gemini', 'codex', 'copilot', 'antigr
|
||||
function parseRuntimeInput(input) {
|
||||
input = input.trim() || '1';
|
||||
|
||||
if (input === '8') {
|
||||
if (input === '9') {
|
||||
return allRuntimes;
|
||||
}
|
||||
|
||||
@@ -73,8 +74,12 @@ describe('multi-runtime selection parsing', () => {
|
||||
assert.deepStrictEqual(parseRuntimeInput('2 , 5'), ['opencode', 'copilot']);
|
||||
});
|
||||
|
||||
test('choice 8 returns all runtimes', () => {
|
||||
assert.deepStrictEqual(parseRuntimeInput('8'), allRuntimes);
|
||||
test('single choice for windsurf', () => {
|
||||
assert.deepStrictEqual(parseRuntimeInput('8'), ['windsurf']);
|
||||
});
|
||||
|
||||
test('choice 9 returns all runtimes', () => {
|
||||
assert.deepStrictEqual(parseRuntimeInput('9'), allRuntimes);
|
||||
});
|
||||
|
||||
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', () => {
|
||||
assert.deepStrictEqual(parseRuntimeInput('9'), ['claude']);
|
||||
assert.deepStrictEqual(parseRuntimeInput('10'), ['claude']);
|
||||
assert.deepStrictEqual(parseRuntimeInput('0'), ['claude']);
|
||||
assert.deepStrictEqual(parseRuntimeInput('abc'), ['claude']);
|
||||
});
|
||||
|
||||
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']);
|
||||
});
|
||||
|
||||
@@ -105,7 +110,7 @@ describe('multi-runtime selection parsing', () => {
|
||||
});
|
||||
|
||||
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)) {
|
||||
assert.ok(
|
||||
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