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
This commit is contained in:
Joe Danziger
2025-07-09 07:22:11 -04:00
committed by GitHub
parent 5f009a5e1f
commit 95c299df64
82 changed files with 4827 additions and 720 deletions

View File

@@ -136,8 +136,8 @@ describe('Selective Rules Removal', () => {
expect(result.filesRemoved).toEqual([
'cursor_rules.mdc',
'taskmaster/dev_workflow.mdc',
'taskmaster/taskmaster.mdc',
'self_improve.mdc'
'self_improve.mdc',
'taskmaster/taskmaster.mdc'
]);
expect(result.notice).toContain('Preserved 2 existing rule files');
@@ -226,8 +226,8 @@ describe('Selective Rules Removal', () => {
expect(result.filesRemoved).toEqual([
'cursor_rules.mdc',
'taskmaster/dev_workflow.mdc',
'taskmaster/taskmaster.mdc',
'self_improve.mdc'
'self_improve.mdc',
'taskmaster/taskmaster.mdc'
]);
// The function may fail due to directory reading issues in the test environment,
@@ -354,8 +354,8 @@ describe('Selective Rules Removal', () => {
// Mock sequence: only Task Master rules, rules dir removed, but profile dir not empty due to MCP
mockReaddirSync
.mockReturnValueOnce(['cursor_rules.mdc']) // Only Task Master files
.mockReturnValueOnce([]) // rules dir empty after removal
.mockReturnValueOnce(['mcp.json']); // Profile dir has MCP config remaining
.mockReturnValueOnce(['my_custom_rule.mdc']) // rules dir has other files remaining
.mockReturnValueOnce(['rules', 'mcp.json']); // Profile dir has rules and MCP config remaining
// Mock MCP config with multiple servers (Task Master will be removed, others preserved)
const mockMcpConfig = {
@@ -400,8 +400,9 @@ describe('Selective Rules Removal', () => {
// Mock sequence: only Task Master rules, rules dir removed, but profile dir has other files/folders
mockReaddirSync
.mockReturnValueOnce(['cursor_rules.mdc']) // Only Task Master files
.mockReturnValueOnce([]) // rules dir empty after removal
.mockReturnValueOnce(['cursor_rules.mdc']) // Only Task Master files (initial check)
.mockReturnValueOnce(['cursor_rules.mdc']) // Task Master files list for filtering
.mockReturnValueOnce([]) // Rules dir empty after removal (not used since no remaining files)
.mockReturnValueOnce(['workflows', 'custom-config.json']); // Profile dir has other files/folders
// Mock MCP config with only Task Master (will be completely deleted)
@@ -420,7 +421,7 @@ describe('Selective Rules Removal', () => {
expect(result.success).toBe(true);
expect(result.profileDirRemoved).toBe(false);
expect(result.mcpResult.deleted).toBe(true);
expect(result.notice).toContain('Preserved 2 existing files/folders');
expect(result.notice).toContain('existing files/folders in .cursor');
// Verify profile directory was NOT removed (other files/folders exist)
expect(mockRmSync).not.toHaveBeenCalledWith(
@@ -587,8 +588,30 @@ describe('Selective Rules Removal', () => {
// Mock mixed scenario: some Task Master files, some existing files, other MCP servers
mockExistsSync.mockImplementation((filePath) => {
if (filePath.includes('.cursor')) return true;
if (filePath.includes('mcp.json')) return true;
// Only .cursor directories exist
if (filePath === path.join(projectRoot, '.cursor')) return true;
if (filePath === path.join(projectRoot, '.cursor/rules')) return true;
if (filePath === path.join(projectRoot, '.cursor/mcp.json'))
return true;
// Only cursor_rules.mdc exists, not the other taskmaster files
if (
filePath === path.join(projectRoot, '.cursor/rules/cursor_rules.mdc')
)
return true;
if (
filePath ===
path.join(projectRoot, '.cursor/rules/taskmaster/dev_workflow.mdc')
)
return false;
if (
filePath === path.join(projectRoot, '.cursor/rules/self_improve.mdc')
)
return false;
if (
filePath ===
path.join(projectRoot, '.cursor/rules/taskmaster/taskmaster.mdc')
)
return false;
return false;
});