fix: prevent CLAUDE.md overwrite by using imports (#949)

* fix: prevent CLAUDE.md overwrite by using imports

- Copy Task Master instructions to .taskmaster/CLAUDE.md
- Add import section to user's CLAUDE.md instead of overwriting
- Preserve existing user content
- Clean removal of Task Master content on uninstall

Closes #929

* chore: add changeset for Claude import fix
This commit is contained in:
Ben Vargas
2025-07-14 02:29:36 -06:00
committed by GitHub
parent a8e2d728c9
commit f662654afb
3 changed files with 148 additions and 4 deletions

View File

@@ -23,7 +23,9 @@ describe('Claude Profile Initialization Functionality', () => {
expect(claudeProfileContent).toContain("rulesDir: '.'"); // non-default
expect(claudeProfileContent).toContain('mcpConfig: false'); // non-default
expect(claudeProfileContent).toContain('includeDefaultRules: false'); // non-default
expect(claudeProfileContent).toContain("'AGENTS.md': 'CLAUDE.md'");
expect(claudeProfileContent).toContain(
"'AGENTS.md': '.taskmaster/CLAUDE.md'"
);
// Check the final computed properties on the profile object
expect(claudeProfile.profileName).toBe('claude');
@@ -33,7 +35,7 @@ describe('Claude Profile Initialization Functionality', () => {
expect(claudeProfile.mcpConfig).toBe(false);
expect(claudeProfile.mcpConfigName).toBe(null); // computed
expect(claudeProfile.includeDefaultRules).toBe(false);
expect(claudeProfile.fileMap['AGENTS.md']).toBe('CLAUDE.md');
expect(claudeProfile.fileMap['AGENTS.md']).toBe('.taskmaster/CLAUDE.md');
});
test('claude.js has lifecycle functions for file management', () => {
@@ -44,9 +46,11 @@ describe('Claude Profile Initialization Functionality', () => {
);
});
test('claude.js handles .claude directory in lifecycle functions', () => {
test('claude.js handles .claude directory and .taskmaster/CLAUDE.md import in lifecycle functions', () => {
expect(claudeProfileContent).toContain('.claude');
expect(claudeProfileContent).toContain('copyRecursiveSync');
expect(claudeProfileContent).toContain('.taskmaster/CLAUDE.md');
expect(claudeProfileContent).toContain('@./.taskmaster/CLAUDE.md');
});
test('claude.js has proper error handling in lifecycle functions', () => {