refactor: replace specific character regex with comprehensive non-alphanumeric pattern

Update the regex in getProjectPath to replace all non-alphanumeric characters
with dashes instead of only specific ones. This provides more robust handling
of edge cases in working directory paths.
This commit is contained in:
weishu
2025-12-31 12:18:34 +08:00
parent 705ce24e17
commit d61cfc90c2
+1 -1
View File
@@ -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(/[^a-zA-Z0-9]/g, '-');
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
return join(claudeConfigDir, 'projects', projectId);
}