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
12 changes: 12 additions & 0 deletions tools/diagnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,18 @@ def main():
appdata_claude_dir = os.path.join(
os.environ.get("APPDATA", os.path.expanduser("~")), "Claude"
)
if not os.path.isdir(appdata_claude_dir):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Detect MSIX Desktop before printing repair commands

When this new Store fallback makes MSIX metadata visible, desktop_running is still computed by _detect_desktop_running(), which treats a running claude.exe as Desktop only when its executable path contains AnthropicClaude; an MSIX install under the Claude_* package path won't match that check. In that Store-install context, diagnose.py can now emit runnable mutator commands without the QUIT DESKTOP FIRST warning even while Desktop is open, violating the repo's safety boundary and risking Desktop overwriting the repair on its next flush.

Useful? React with 👍 / 👎.

_local = os.environ.get("LOCALAPPDATA", "")
_pkgs = os.path.join(_local, "Packages")
if os.path.isdir(_pkgs):
for _pkg in sorted(os.listdir(_pkgs)):
if _pkg.startswith("Claude_"):
_cand = os.path.join(
_pkgs, _pkg, "LocalCache", "Roaming", "Claude"
)
if os.path.isdir(_cand):
appdata_claude_dir = _cand
break
projects_dir = os.path.join(os.path.expanduser("~"), ".claude", "projects")

snapshot = build_snapshot(appdata_claude_dir, projects_dir, fixture_mode=args.state is not None)
Expand Down
18 changes: 17 additions & 1 deletion tools/sessions/repair_session_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,23 @@ def _default_paths():
os.path.expanduser("~/.config/Claude"),
os.path.expanduser("~/.claude/projects"),
)
_appdata_claude = os.path.join(
os.environ.get("APPDATA", os.path.expanduser("~")), "Claude"
)
if not os.path.isdir(_appdata_claude):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fall back when the AppData root is empty

This guard only checks whether %APPDATA%\Claude exists, not whether it contains usable claude-code-sessions metadata. In a Store/MSIX environment with a leftover or empty standard-install %APPDATA%\Claude directory, the fallback to %LOCALAPPDATA%\Packages\Claude_*\LocalCache\Roaming\Claude is skipped, so diagnose/repair still operate on the empty root and report no metadata even though the Store data exists.

Useful? React with 👍 / 👎.

_local = os.environ.get("LOCALAPPDATA", "")
_pkgs = os.path.join(_local, "Packages")
if os.path.isdir(_pkgs):
for _pkg in sorted(os.listdir(_pkgs)):
if _pkg.startswith("Claude_"):
_cand = os.path.join(
_pkgs, _pkg, "LocalCache", "Roaming", "Claude"
)
if os.path.isdir(_cand):
_appdata_claude = _cand
break
return (
os.path.join(os.environ.get("APPDATA", os.path.expanduser("~")), "Claude"),
_appdata_claude,
os.path.join(os.path.expanduser("~"), ".claude", "projects"),
)

Expand Down Expand Up @@ -408,6 +423,7 @@ def main():
shutil.copy2(path, os.path.join(BACKUP_DIR, fname))
repaired_meta = dict(meta)
repaired_meta["cliSessionId"] = cli_match
repaired_meta.pop("transcriptUnavailable", None)
with open(path, "w", encoding="utf-8") as fh:
json.dump(repaired_meta, fh, indent=2)

Expand Down
Loading