Files
claude-task-master/tests/unit/profiles/subdirectory-support.test.js
Joe Danziger 95c299df64 Unify and streamline profile system architecture (#853)
* move claude rules and commands to assets/claude

* update claude profile to copy assets/claude to .claude

* fix formatting

* feat(profiles): Implement unified profile system

- Convert Claude and Codex profiles to use createProfile() factory
- Remove simple vs complex profile distinction in rule transformer
- Unify convertAllRulesToProfileRules() to handle all profiles consistently
- Fix mcpConfigPath construction in base-profile.js for null mcpConfigName
- Update terminology from 'simpleProfiles' to 'assetOnlyProfiles' throughout
- Ensure Claude .claude directory copying works in both CLI and MCP contexts
- All profiles now follow same execution flow with proper lifecycle functions

Changes:
- src/profiles/claude.js: Convert to createProfile() factory pattern
- src/profiles/codex.js: Convert to createProfile() factory pattern
- src/utils/rule-transformer.js: Unified profile handling logic
- src/utils/profiles.js: Remove simple profile categorization
- src/profiles/base-profile.js: Fix mcpConfigPath construction
- scripts/modules/commands.js: Update variable naming
- tests/: Update all tests for unified system and terminology

Fixes Claude profile asset copying issue in MCP context.
All tests passing (617 passed, 11 skipped).

* re-checkin claude files

* fix formatting

* chore: clean up test Claude rules files

* chore: add changeset for unified profile system

* add claude files back

* add changeset

* restore proper gitignore

* remove claude agents file from root

* remove incorrect doc

* simplify profiles and update tests

* update changeset

* update changeset

* remove profile specific code

* streamline profiles with defaults and update tests

* update changeset

* add newline at end of gitignore

* restore changes

* streamline profiles with defaults; update tests and add vscode test

* update rule profile tests

* update wording for clearer profile management

* refactor and clarify terminology

* use original projectRoot var name

* revert param desc

* use updated claude assets from neno

* add "YOUR_" before api key here

* streamline codex profile

* add gemini profile

* update gemini profile

* update tests

* relocate function

* update rules interactive setup Gemini desc

* remove duplicative code

* add comma
2025-07-09 13:22:11 +02:00

65 lines
2.2 KiB
JavaScript

// 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['rules/dev_workflow.mdc']).toBe(
'taskmaster/dev_workflow.mdc'
);
expect(cursorProfile.fileMap['rules/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['rules/dev_workflow.mdc']).toBe(
`dev_workflow${expectedExt}`
);
expect(profile.fileMap['rules/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);
});
});
});