Files
hapi/cli/src/claude/utils/path.ts
T
weishu d61cfc90c2 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.
2025-12-31 12:18:34 +08:00

8 lines
364 B
TypeScript

import { homedir } from "node:os";
import { join, resolve } from "node:path";
export function getProjectPath(workingDirectory: string) {
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);
}