Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/claude/utils/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ describe('getProjectPath', () => {
expect(result).toBe(join('/home/user', '.claude', 'projects', '-var-www-my-site-com-public'));
});

it('should replace underscores with hyphens in the project path', () => {
const workingDir = '/var/www/test__underscore';
const result = getProjectPath(workingDir);
expect(result).toBe(join('/home/user', '.claude', 'projects', '-var-www-test--underscore'));
});

it('should handle relative paths by resolving them first', () => {
const workingDir = './my-project';
const result = getProjectPath(workingDir);
Expand Down Expand Up @@ -86,4 +92,4 @@ describe('getProjectPath', () => {
expect(result).toBe(join('/custom/claude/config/', 'projects', '-Users-steve-projects-my-app'));
});
});
});
});
2 changes: 1 addition & 1 deletion src/claude/utils/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { homedir } from "node:os";
import { join, resolve } from "node:path";

export function getProjectPath(workingDirectory: string) {
const projectId = resolve(workingDirectory).replace(/[\\\/\.:]/g, '-');
const projectId = resolve(workingDirectory).replace(/[\\\/\.:_]/g, '-');
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
return join(claudeConfigDir, 'projects', projectId);
}