Skip to content

Commit 074c341

Browse files
committed
fix(profiles): fix vscode profile generation
- Add .instructions.md extension for VSCode Copilot instructions file. - Add customReplacement to remove unsupported property `alwaysApply` from YAML front-matter in VSCode instructions files. - Add missing property `targetExtension` to the base profile object to support the change to file extension.
1 parent d87a7f1 commit 074c341

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

.changeset/swift-otters-argue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"task-master-ai": patch
3+
---
4+
5+
Fix VSCode profile generation to use correct rule file names (using `.instructions.md` extension instead of just `.md`) and front-matter properties (removing the unsupported `alwaysApply` property from the instructions files front-matter).

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/profiles/base-profile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ export function createProfile(editorConfig) {
234234
globalReplacements: baseGlobalReplacements,
235235
conversionConfig,
236236
getTargetRuleFilename,
237+
targetExtension,
237238
// Optional lifecycle hooks
238239
...(onAdd && { onAddRulesProfile: onAdd }),
239240
...(onRemove && { onRemoveRulesProfile: onRemove }),

src/profiles/vscode.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export const vscodeProfile = createProfile({
166166
rulesDir: '.github/instructions', // VS Code instructions location
167167
profileDir: '.vscode', // VS Code configuration directory
168168
mcpConfigName: 'mcp.json', // VS Code uses mcp.json in .vscode directory
169+
targetExtension: '.instructions.md',
169170
customReplacements: [
170171
// Core VS Code directory structure changes
171172
{ from: /\.cursor\/rules/g, to: '.github/instructions' },
@@ -177,10 +178,13 @@ export const vscodeProfile = createProfile({
177178
// VS Code custom instructions format - use applyTo with quoted patterns instead of globs
178179
{ from: /^globs:\s*(.+)$/gm, to: 'applyTo: "$1"' },
179180

181+
// Remove unsupported property - alwaysApply
182+
{ from: /^alwaysApply:\s*(true|false)\s*\n?/gm, to: '' },
183+
180184
// Essential markdown link transformations for VS Code structure
181185
{
182186
from: /\[(.+?)\]\(mdc:\.cursor\/rules\/(.+?)\.mdc\)/g,
183-
to: '[$1](.github/instructions/$2.md)'
187+
to: '[$1](.github/instructions/$2.instructions.md)'
184188
},
185189

186190
// VS Code specific terminology

tests/integration/profiles/vscode-init-functionality.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ describe('VSCode Profile Initialization Functionality', () => {
3535
expect(Array.isArray(vscodeProfile.globalReplacements)).toBe(true);
3636
});
3737

38-
test('vscode.js configures .mdc to .md extension mapping', () => {
38+
test('vscode.js configures .mdc to .instructions.md extension mapping', () => {
3939
// Check that the profile object has the correct file mapping behavior (vscode converts to .md)
4040
expect(vscodeProfile.fileMap['rules/cursor_rules.mdc']).toBe(
41-
'vscode_rules.md'
41+
'vscode_rules.instructions.md'
4242
);
4343
});
4444

tests/unit/profiles/rule-transformer-vscode.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Also has references to .mdc files and cursor rules.`;
7676
expect(transformedContent).not.toContain('cursor.so');
7777
expect(transformedContent).not.toContain('Cursor rule');
7878
expect(transformedContent).not.toContain('globs:');
79+
expect(transformedContent).not.toContain('alwaysApply:');
7980
});
8081

8182
it('should correctly convert tool references', () => {
@@ -132,7 +133,7 @@ Files are in the .cursor/rules directory and we should reference the rules direc
132133
// Call the actual function
133134
const result = convertRuleToProfileRule(
134135
'source.mdc',
135-
'target.md',
136+
'target.instructions.md',
136137
vscodeProfile
137138
);
138139

@@ -148,10 +149,10 @@ Files are in the .cursor/rules directory and we should reference the rules direc
148149
'applyTo: ".github/instructions/*.md"'
149150
); // globs -> applyTo with path transformation
150151
expect(transformedContent).toContain(
151-
'(.github/instructions/dev_workflow.md)'
152+
'(.github/instructions/dev_workflow.instructions.md)'
152153
); // File path transformation - no taskmaster subdirectory for VS Code
153154
expect(transformedContent).toContain(
154-
'(.github/instructions/taskmaster.md)'
155+
'(.github/instructions/taskmaster.instructions.md)'
155156
); // File path transformation - no taskmaster subdirectory for VS Code
156157
expect(transformedContent).toContain('instructions directory'); // "rules directory" -> "instructions directory"
157158
expect(transformedContent).not.toContain('(mdc:.cursor/rules/');

0 commit comments

Comments
 (0)