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:
@@ -1,5 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { clineProfile } from '../../../src/profiles/cline.js';
|
||||
|
||||
describe('Cline Profile Initialization Functionality', () => {
|
||||
let clineProfileContent;
|
||||
@@ -10,39 +11,48 @@ describe('Cline Profile Initialization Functionality', () => {
|
||||
});
|
||||
|
||||
test('cline.js uses factory pattern with correct configuration', () => {
|
||||
// Check for explicit, non-default values in the source file
|
||||
expect(clineProfileContent).toContain("name: 'cline'");
|
||||
expect(clineProfileContent).toContain("displayName: 'Cline'");
|
||||
expect(clineProfileContent).toContain("rulesDir: '.clinerules'");
|
||||
expect(clineProfileContent).toContain("profileDir: '.clinerules'");
|
||||
expect(clineProfileContent).toContain("profileDir: '.clinerules'"); // non-default
|
||||
expect(clineProfileContent).toContain("rulesDir: '.clinerules'"); // non-default
|
||||
expect(clineProfileContent).toContain('mcpConfig: false'); // non-default
|
||||
|
||||
// Check the final computed properties on the profile object
|
||||
expect(clineProfile.profileName).toBe('cline');
|
||||
expect(clineProfile.displayName).toBe('Cline');
|
||||
expect(clineProfile.profileDir).toBe('.clinerules');
|
||||
expect(clineProfile.rulesDir).toBe('.clinerules');
|
||||
expect(clineProfile.mcpConfig).toBe(false);
|
||||
expect(clineProfile.mcpConfigName).toBe(null);
|
||||
});
|
||||
|
||||
test('cline.js configures .mdc to .md extension mapping', () => {
|
||||
expect(clineProfileContent).toContain("fileExtension: '.mdc'");
|
||||
expect(clineProfileContent).toContain("targetExtension: '.md'");
|
||||
});
|
||||
|
||||
test('cline.js uses standard tool mappings', () => {
|
||||
expect(clineProfileContent).toContain('COMMON_TOOL_MAPPINGS.STANDARD');
|
||||
// Should contain comment about standard tool names
|
||||
expect(clineProfileContent).toContain('standard tool names');
|
||||
});
|
||||
|
||||
test('cline.js contains correct URL configuration', () => {
|
||||
expect(clineProfileContent).toContain("url: 'cline.bot'");
|
||||
expect(clineProfileContent).toContain("docsUrl: 'docs.cline.bot'");
|
||||
});
|
||||
|
||||
test('cline.js has MCP configuration disabled', () => {
|
||||
expect(clineProfileContent).toContain('mcpConfig: false');
|
||||
expect(clineProfileContent).toContain(
|
||||
"mcpConfigName: 'cline_mcp_settings.json'"
|
||||
// Check that the profile object has the correct file mapping behavior (cline converts to .md)
|
||||
expect(clineProfile.fileMap['rules/cursor_rules.mdc']).toBe(
|
||||
'cline_rules.md'
|
||||
);
|
||||
});
|
||||
|
||||
test('cline.js uses standard tool mappings', () => {
|
||||
// Check that the profile uses default tool mappings (equivalent to COMMON_TOOL_MAPPINGS.STANDARD)
|
||||
// This verifies the architectural pattern: no custom toolMappings = standard tool names
|
||||
expect(clineProfileContent).not.toContain('toolMappings:');
|
||||
expect(clineProfileContent).not.toContain('apply_diff');
|
||||
expect(clineProfileContent).not.toContain('search_files');
|
||||
|
||||
// Verify the result: default mappings means tools keep their original names
|
||||
expect(clineProfile.conversionConfig.toolNames.edit_file).toBe('edit_file');
|
||||
expect(clineProfile.conversionConfig.toolNames.search).toBe('search');
|
||||
});
|
||||
|
||||
test('cline.js has custom file mapping for cursor_rules.mdc', () => {
|
||||
expect(clineProfileContent).toContain('customFileMap:');
|
||||
expect(clineProfileContent).toContain(
|
||||
"'cursor_rules.mdc': 'cline_rules.md'"
|
||||
// Check actual behavior - cline gets default rule files
|
||||
expect(Object.keys(clineProfile.fileMap)).toContain(
|
||||
'rules/cursor_rules.mdc'
|
||||
);
|
||||
expect(clineProfile.fileMap['rules/cursor_rules.mdc']).toBe(
|
||||
'cline_rules.md'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user