Files
hapi/cli/src/claude/utils/path.ts
T
f069eda79e fix(cli): follow Claude transcript relocated into a git worktree (#2208)
Claude Code moves the session transcript to the new cwd's project dir
when the session enters or leaves a git worktree. The local-mode scanner
pinned the launch project dir, so nothing reached the web until the
session left the worktree. Look the transcript up by session id across
project dirs when the known path is gone.

Fixes #1950

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:01:45 +08:00

12 lines
405 B
TypeScript

import { homedir } from "node:os";
import { join, resolve } from "node:path";
export function getClaudeProjectsDir() {
return join(process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude'), 'projects');
}
export function getProjectPath(workingDirectory: string) {
const projectId = resolve(workingDirectory).replace(/[^a-zA-Z0-9]/g, '-');
return join(getClaudeProjectsDir(), projectId);
}