fix(cursor): write unquoted skill and subagent names
Prevent Cursor from treating frontmatter quotes as part of skill/subagent identifiers by emitting plain name scalars, and add regression tests to lock the conversion behavior. Made-with: Cursor
This commit is contained in:
61
tests/cursor-conversion.test.cjs
Normal file
61
tests/cursor-conversion.test.cjs
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Cursor conversion regression tests.
|
||||
*
|
||||
* Ensures Cursor frontmatter names are emitted as plain identifiers
|
||||
* (without surrounding quotes), so Cursor 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 {
|
||||
convertClaudeCommandToCursorSkill,
|
||||
convertClaudeAgentToCursorAgent,
|
||||
} = require('../bin/install.js');
|
||||
|
||||
describe('convertClaudeCommandToCursorSkill', () => {
|
||||
test('writes unquoted Cursor skill name in frontmatter', () => {
|
||||
const input = `---
|
||||
name: quick
|
||||
description: Execute a quick task
|
||||
---
|
||||
|
||||
<objective>
|
||||
Test body
|
||||
</objective>
|
||||
`;
|
||||
|
||||
const result = convertClaudeCommandToCursorSkill(input, 'gsd-quick');
|
||||
const nameMatch = result.match(/^name:\s*(.+)$/m);
|
||||
|
||||
assert.ok(nameMatch, 'frontmatter contains name field');
|
||||
assert.equal(nameMatch[1], 'gsd-quick', 'skill name is plain scalar');
|
||||
assert.ok(!result.includes('name: "gsd-quick"'), 'quoted skill name is not emitted');
|
||||
});
|
||||
});
|
||||
|
||||
describe('convertClaudeAgentToCursorAgent', () => {
|
||||
test('writes unquoted Cursor agent name in frontmatter', () => {
|
||||
const input = `---
|
||||
name: gsd-planner
|
||||
description: Planner agent
|
||||
tools: Read, Write
|
||||
color: green
|
||||
---
|
||||
|
||||
<role>
|
||||
Planner body
|
||||
</role>
|
||||
`;
|
||||
|
||||
const result = convertClaudeAgentToCursorAgent(input);
|
||||
const nameMatch = result.match(/^name:\s*(.+)$/m);
|
||||
|
||||
assert.ok(nameMatch, 'frontmatter contains name field');
|
||||
assert.equal(nameMatch[1], 'gsd-planner', 'agent name is plain scalar');
|
||||
assert.ok(!result.includes('name: "gsd-planner"'), 'quoted agent name is not emitted');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user