Skip to content

Add WSL2 Claude Code detection and sync support#149

Open
tylergraydev wants to merge 1 commit into
mainfrom
feat/wsl2-support
Open

Add WSL2 Claude Code detection and sync support#149
tylergraydev wants to merge 1 commit into
mainfrom
feat/wsl2-support

Conversation

@tylergraydev
Copy link
Copy Markdown
Owner

Summary

  • Detects Claude Code installations inside WSL2 distros from the Windows host via wsl.exe
  • Each WSL distro appears as a separate toggleable editor (e.g., "Claude Code (WSL: Ubuntu)") in the settings UI
  • MCP config sync writes ~/.claude.json inside WSL distros through wsl.exe commands
  • Users with both native Windows and WSL Claude Code can independently enable/disable sync to each
  • All WSL code is #[cfg(target_os = "windows")] gated — no-ops on other platforms
  • Fixes 12 preexisting TypeScript errors across analytics, sessions, skills, and test files

New files

  • src-tauri/src/utils/wsl.rs — WSL2 detection, distro listing, file I/O through wsl.exe, UTF-16LE decoding
  • src-tauri/src/services/wsl_config.rs — Config writer for WSL distros (same claude.json format)

Modified files

  • Backend: settings.rs, config.rs, models.rs, lib.rs, mod.rs files — WSL editor detection, sync, and command registration
  • Frontend: SettingsEditorSyncTab.svelte — WSL editors get amber "W" badge with proper display names
  • Type fixes: skill.ts, usageStore.svelte.ts, invokeMock.ts, skillLibrary.test.ts, sessions/+page.svelte

Test plan

  • All 859 Rust tests pass
  • svelte-check reports 0 errors (down from 12)
  • Manual test on Windows with WSL2 installed — verify distros appear in editor list
  • Manual test toggling WSL editor and syncing MCPs
  • Verify no impact on macOS/Linux builds (WSL code is cfg-gated)

@farridav
Copy link
Copy Markdown

farridav commented Apr 7, 2026

+1 for this, i can run this tool from inside of wsl, but it seems to be a much nicer, cleaner pattern to be able to dip into WSL.

any ideas when this might make it through ? fantastic work by the way ;)

@tylergraydev
Copy link
Copy Markdown
Owner Author

Whenever I have some time to test it some, I will work on a release. If you wanted to pull the branch and build it and let me know how it goes, that would be very helpful.

Rebased onto current main. The original commit also included fixes
for preexisting type errors across usageStore/skill/invokeMock/etc.,
but main has since landed canonical fixes for all of them (#221, #226,
#227, #236), so those parts of the original commit are dropped.

Net change: WSL2-specific Rust code (utils/wsl.rs, services/wsl_config.rs)
plus the settings/config plumbing to expose WSL editors in the UI.

See PR #149 for full description.
@tylergraydev
Copy link
Copy Markdown
Owner Author

Rebased onto current main (was 76 commits behind, from 2026-04 era).

Changes during the rebase

Conflicts resolved (3):

Duplicates removed:
The original commit's "fix preexisting type errors" hunk added `filteredDailyCosts` and `startPolling`/`stopPolling` to `usageStore.svelte.ts`. Main has since landed canonical versions of both via #221/#226. The rebase auto-merged them side-by-side, producing two declarations of each (compile error: "has already been declared"). Deleted the branch's duplicates — main's are what the test suite asserts against.

Commit message updated to drop the "fix preexisting type errors" suffix since main now owns those fixes.

Verification

  • `npm run check` — 18 errors (same as main's baseline — zero new TS errors from this branch)
  • `npx vitest run` — 1567/1567 pass (84 files; 2 more than main = the branch's own new tests)
  • `cargo check` (src-tauri) — builds clean, 3 warnings (1 `mkdir_wsl` unused fn — pre-existing)

Net surface: 10 files, +618 / -9 (was 14 files / +662 / -12 in the original). WSL2-specific code (`utils/wsl.rs`, `services/wsl_config.rs`) and settings plumbing only — no longer touches type-fix files that main handles.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants