fix(profiles): fix vscode profile generation (#1027)

* 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.

* chore: run format

---------

Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com>
This commit is contained in:
Andre Silva
2025-07-21 16:17:57 -03:00
committed by GitHub
parent 8781794c56
commit 6ae66b2afb
6 changed files with 18 additions and 10 deletions

View File

@@ -234,6 +234,7 @@ export function createProfile(editorConfig) {
globalReplacements: baseGlobalReplacements,
conversionConfig,
getTargetRuleFilename,
targetExtension,
// Optional lifecycle hooks
...(onAdd && { onAddRulesProfile: onAdd }),
...(onRemove && { onRemoveRulesProfile: onRemove }),

View File

@@ -166,6 +166,7 @@ export const vscodeProfile = createProfile({
rulesDir: '.github/instructions', // VS Code instructions location
profileDir: '.vscode', // VS Code configuration directory
mcpConfigName: 'mcp.json', // VS Code uses mcp.json in .vscode directory
targetExtension: '.instructions.md',
customReplacements: [
// Core VS Code directory structure changes
{ from: /\.cursor\/rules/g, to: '.github/instructions' },
@@ -177,10 +178,13 @@ export const vscodeProfile = createProfile({
// VS Code custom instructions format - use applyTo with quoted patterns instead of globs
{ from: /^globs:\s*(.+)$/gm, to: 'applyTo: "$1"' },
// Remove unsupported property - alwaysApply
{ from: /^alwaysApply:\s*(true|false)\s*\n?/gm, to: '' },
// Essential markdown link transformations for VS Code structure
{
from: /\[(.+?)\]\(mdc:\.cursor\/rules\/(.+?)\.mdc\)/g,
to: '[$1](.github/instructions/$2.md)'
to: '[$1](.github/instructions/$2.instructions.md)'
},
// VS Code specific terminology