Skip to content

adopt: Linux client paths, process names and shell exports - #172

Merged
fylorn merged 1 commit into
mainfrom
linux/adopt
Sep 24, 2026
Merged

fylorn merged 1 commit into
mainfrom
linux/adopt

Conversation

@fylorn

@fylorn fylorn commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Linux support for tw-adopt (client detection, takeover, manual steps, diagnosis).

Paths

  • paths::Loc: a config location is either home-relative or XDG-relative. XDG variables are honoured only when the home passed in is the process's own $HOME (%USERPROFILE%), so tests that pass a temp home never touch the developer's real config. Relative XDG values are ignored, per the spec.
  • opencode: $XDG_CONFIG_HOME/opencode on every platform (it uses xdg-basedir); data marker $XDG_DATA_HOME/opencode.
  • Zed: $XDG_CONFIG_HOME/zed on Linux; macOS stays ~/.config/zed (Zed hard-codes it there); Windows unchanged.
  • Claude Desktop now has a Linux beta (Debian/Ubuntu). Electron userData → $XDG_CONFIG_HOME/Claude/claude_desktop_config.json. It stays in the MCP target list and the scan.
  • Claude Code managed policy: /etc/claude-code/managed-settings.json on Linux. Windows fix: %ProgramFiles%\ClaudeCode\managed-settings.json; the docs say C:\ProgramData\ClaudeCode is no longer read.
  • McpTargetView.path now carries the displayable path (~/.claude.json), not the bare relative string.
  • Project-level config lookup only applies to home-relative clients (no more <project>/.config/opencode/...).

Process detection (running_since)

  • One parser for ps -Ao pid=,etime=,comm= lines (macOS full paths with spaces, Linux 15-byte names). Match by name prefix instead of substring.
  • Zed's process name per platform: zed-editor on Linux (libexec/zed-editor; bin/zed is the CLI), zed on macOS (Zed.app/Contents/MacOS/zed — the old "Zed" marker never matched there either), Zed on Windows.
  • npm installs: Codex's node wrapper is ignored, its native codex child is matched; Claude Code and opencode npm packages install native binaries.

Shell exports

  • Adds .bash_login. Matches exact variable names on real export statements (no more OPENAI_BASE_URL_OLD or echo $X hits).
  • fish: set with -x/-gx/-Ux/--export (not -e) in config.fish only; bash's set -x is no longer read as an export.
  • The "delete this line" fix is sed -i '{line}d' {path} off macOS (GNU sed rejects -i ''). New msg code adopt.diag.delete_line_gnu.

Tests with realistic Linux and macOS ps lines, fish/bash export parsing and XDG resolution are included.

🤖 Generated with Claude Code

- Claude Code managed policy: /etc/claude-code on Linux; Windows moves to
  %ProgramFiles%\ClaudeCode (the docs say ProgramData is no longer read).
- Config locations become `paths::Loc` (home-relative or XDG-relative).
  opencode (every platform), Zed and Claude Desktop (Linux) honour
  $XDG_CONFIG_HOME / $XDG_DATA_HOME, but only when the home passed in is the
  process's own, so tests with a temp home stay isolated.
- Claude Desktop on Linux (beta) lives at $XDG_CONFIG_HOME/Claude.
- Process detection: parse `ps` lines in one place, match by name prefix
  (Linux truncates comm to 15 bytes), and give Zed its per-platform process
  name (`zed-editor` on Linux, `zed` on macOS, `Zed` on Windows).
- Shell exports: add .bash_login; match exact variable names on real export
  statements; parse fish `set` flags (-x/-gx/-Ux/--export, not -e) only in
  config.fish, so bash's `set -x` is no longer read as an export.
- The "delete this line" fix uses GNU sed syntax off macOS
  (new code adopt.diag.delete_line_gnu).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 65e33fa into main Sep 24, 2026
3 checks passed
@fylorn
fylorn deleted the linux/adopt branch September 24, 2026 09:20
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.

1 participant