add rules subdirectory support per-profile
This commit is contained in:
@@ -138,13 +138,9 @@ This references [dev_workflow.mdc](mdc:.cursor/rules/dev_workflow.mdc) and
|
||||
const writeCall = mockWriteFileSync.mock.calls[0];
|
||||
const transformedContent = writeCall[1];
|
||||
|
||||
// Verify transformations - files should now be in taskmaster subdirectory
|
||||
expect(transformedContent).toContain(
|
||||
'(.clinerules/taskmaster/dev_workflow.md)'
|
||||
);
|
||||
expect(transformedContent).toContain(
|
||||
'(.clinerules/taskmaster/taskmaster.md)'
|
||||
);
|
||||
// Verify file path transformations - no taskmaster subdirectory for Cline
|
||||
expect(transformedContent).toContain('(.clinerules/dev_workflow.md)');
|
||||
expect(transformedContent).toContain('(.clinerules/taskmaster.md)');
|
||||
expect(transformedContent).not.toContain('(mdc:.cursor/rules/');
|
||||
});
|
||||
|
||||
|
||||
@@ -138,13 +138,9 @@ This references [dev_workflow.mdc](mdc:.cursor/rules/dev_workflow.mdc) and
|
||||
const writeCall = mockWriteFileSync.mock.calls[0];
|
||||
const transformedContent = writeCall[1];
|
||||
|
||||
// Verify transformations - files should now be in taskmaster subdirectory
|
||||
expect(transformedContent).toContain(
|
||||
'(.roo/rules/taskmaster/dev_workflow.md)'
|
||||
);
|
||||
expect(transformedContent).toContain(
|
||||
'(.roo/rules/taskmaster/taskmaster.md)'
|
||||
);
|
||||
// Verify transformations - no taskmaster subdirectory for Roo
|
||||
expect(transformedContent).toContain('(.roo/rules/dev_workflow.md)'); // File path transformation - no taskmaster subdirectory for Roo
|
||||
expect(transformedContent).toContain('(.roo/rules/taskmaster.md)'); // File path transformation - no taskmaster subdirectory for Roo
|
||||
expect(transformedContent).not.toContain('(mdc:.cursor/rules/');
|
||||
});
|
||||
|
||||
|
||||
@@ -138,13 +138,9 @@ This references [dev_workflow.mdc](mdc:.cursor/rules/dev_workflow.mdc) and
|
||||
const writeCall = mockWriteFileSync.mock.calls[0];
|
||||
const transformedContent = writeCall[1];
|
||||
|
||||
// Verify transformations - files should now be in taskmaster subdirectory
|
||||
expect(transformedContent).toContain(
|
||||
'(.trae/rules/taskmaster/dev_workflow.md)'
|
||||
);
|
||||
expect(transformedContent).toContain(
|
||||
'(.trae/rules/taskmaster/taskmaster.md)'
|
||||
);
|
||||
// Verify transformations - no taskmaster subdirectory for Trae
|
||||
expect(transformedContent).toContain('(.trae/rules/dev_workflow.md)'); // File path transformation - no taskmaster subdirectory for Trae
|
||||
expect(transformedContent).toContain('(.trae/rules/taskmaster.md)'); // File path transformation - no taskmaster subdirectory for Trae
|
||||
expect(transformedContent).not.toContain('(mdc:.cursor/rules/');
|
||||
});
|
||||
|
||||
|
||||
@@ -148,11 +148,11 @@ Files are in the .cursor/rules directory and we should reference the rules direc
|
||||
'applyTo: ".github/instructions/*.md"'
|
||||
); // globs -> applyTo with path transformation
|
||||
expect(transformedContent).toContain(
|
||||
'(.github/instructions/taskmaster/dev_workflow.md)'
|
||||
); // File path transformation
|
||||
'(.github/instructions/dev_workflow.md)'
|
||||
); // File path transformation - no taskmaster subdirectory for VS Code
|
||||
expect(transformedContent).toContain(
|
||||
'(.github/instructions/taskmaster/taskmaster.md)'
|
||||
); // File path transformation
|
||||
'(.github/instructions/taskmaster.md)'
|
||||
); // File path transformation - no taskmaster subdirectory for VS Code
|
||||
expect(transformedContent).toContain('instructions directory'); // "rules directory" -> "instructions directory"
|
||||
expect(transformedContent).not.toContain('(mdc:.cursor/rules/');
|
||||
expect(transformedContent).not.toContain('.cursor/rules');
|
||||
|
||||
@@ -138,13 +138,9 @@ This references [dev_workflow.mdc](mdc:.cursor/rules/dev_workflow.mdc) and
|
||||
const writeCall = mockWriteFileSync.mock.calls[0];
|
||||
const transformedContent = writeCall[1];
|
||||
|
||||
// Verify transformations - files should now be in taskmaster subdirectory
|
||||
expect(transformedContent).toContain(
|
||||
'(.windsurf/rules/taskmaster/dev_workflow.md)'
|
||||
);
|
||||
expect(transformedContent).toContain(
|
||||
'(.windsurf/rules/taskmaster/taskmaster.md)'
|
||||
);
|
||||
// Verify transformations - no taskmaster subdirectory for Windsurf
|
||||
expect(transformedContent).toContain('(.windsurf/rules/dev_workflow.md)'); // File path transformation - no taskmaster subdirectory for Windsurf
|
||||
expect(transformedContent).toContain('(.windsurf/rules/taskmaster.md)'); // File path transformation - no taskmaster subdirectory for Windsurf
|
||||
expect(transformedContent).not.toContain('(mdc:.cursor/rules/');
|
||||
});
|
||||
|
||||
|
||||
64
tests/unit/profiles/subdirectory-support.test.js
Normal file
64
tests/unit/profiles/subdirectory-support.test.js
Normal file
@@ -0,0 +1,64 @@
|
||||
// Test for supportsRulesSubdirectories feature
|
||||
import { getRulesProfile } from '../../../src/utils/rule-transformer.js';
|
||||
|
||||
describe('Rules Subdirectory Support Feature', () => {
|
||||
it('should support taskmaster subdirectories only for Cursor profile', () => {
|
||||
// Test Cursor profile - should use subdirectories
|
||||
const cursorProfile = getRulesProfile('cursor');
|
||||
expect(cursorProfile.supportsRulesSubdirectories).toBe(true);
|
||||
|
||||
// Verify that Cursor uses taskmaster subdirectories in its file mapping
|
||||
expect(cursorProfile.fileMap['dev_workflow.mdc']).toBe(
|
||||
'taskmaster/dev_workflow.mdc'
|
||||
);
|
||||
expect(cursorProfile.fileMap['taskmaster.mdc']).toBe(
|
||||
'taskmaster/taskmaster.mdc'
|
||||
);
|
||||
});
|
||||
|
||||
it('should not use taskmaster subdirectories for other profiles', () => {
|
||||
// Test profiles that should NOT use subdirectories (new default)
|
||||
const profiles = ['roo', 'vscode', 'cline', 'windsurf', 'trae'];
|
||||
|
||||
profiles.forEach((profileName) => {
|
||||
const profile = getRulesProfile(profileName);
|
||||
expect(profile.supportsRulesSubdirectories).toBe(false);
|
||||
|
||||
// Verify that these profiles do NOT use taskmaster subdirectories in their file mapping
|
||||
const expectedExt = profile.targetExtension || '.md';
|
||||
expect(profile.fileMap['dev_workflow.mdc']).toBe(
|
||||
`dev_workflow${expectedExt}`
|
||||
);
|
||||
expect(profile.fileMap['taskmaster.mdc']).toBe(
|
||||
`taskmaster${expectedExt}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('should have supportsRulesSubdirectories property accessible on all profiles', () => {
|
||||
const allProfiles = [
|
||||
'cursor',
|
||||
'roo',
|
||||
'vscode',
|
||||
'cline',
|
||||
'windsurf',
|
||||
'trae'
|
||||
];
|
||||
|
||||
allProfiles.forEach((profileName) => {
|
||||
const profile = getRulesProfile(profileName);
|
||||
expect(profile).toBeDefined();
|
||||
expect(typeof profile.supportsRulesSubdirectories).toBe('boolean');
|
||||
});
|
||||
});
|
||||
|
||||
it('should default to false for supportsRulesSubdirectories when not specified', () => {
|
||||
// Most profiles should now default to NOT supporting subdirectories
|
||||
const profiles = ['roo', 'windsurf', 'trae', 'vscode', 'cline'];
|
||||
|
||||
profiles.forEach((profileName) => {
|
||||
const profile = getRulesProfile(profileName);
|
||||
expect(profile.supportsRulesSubdirectories).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user