Claude Code CLI writes project dirs under ~/.claude/projects/ by
collapsing spaces and "~" to "-" (alongside / : _ and non-ASCII), but
encodeClaudeProjectKey only handled / : _ and non-ASCII. So for work
dirs under macOS iCloud Drive (.../Mobile Documents/com~apple~CloudDocs/...)
the encoded key never matched the on-disk directory — primary lookup,
legacy candidates and the fallback scan all missed, findProjectDir
returned "", and /list always reported "(0) 未找到此项目的会话".
Extend the replacement set to also collapse space and "~" to "-".
Add test cases for paths with spaces, with "~", and the combined
iCloud-style path, plus a findProjectDir regression test.
Co-authored-by: silverzhouyinhe <zhousilver85@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>