Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Fixes Ghostty detection on macOS when installed via Homebrew or as an app bundle.

Changes

Terminal Detection:

  • Check Ghostty in common macOS paths before falling back to PATH:
    • /opt/homebrew/bin/ghostty (Homebrew)
    • /Applications/Ghostty.app/Contents/MacOS/ghostty (App bundle)
    • /usr/local/bin/ghostty (manual install)
  • Use async fs.stat() with executable bit checking (0o111)
  • Convert terminal detection to fully async operations

ESLint Rule:

  • Add local/no-sync-fs-methods rule to ban sync filesystem operations
  • Catches statSync, readFileSync, existsSync, etc.
  • Provides helpful error messages with async alternatives

Testing

Verify with:

make typecheck  # ✅ Passes
make lint       # Shows existing sync fs usage in other files

Generated with cmux

- Add macOS-specific Ghostty detection for Homebrew and app bundle paths
- Convert terminal detection to async operations using fs.stat()
- Add ESLint rule to prevent synchronous filesystem operations
- Check /opt/homebrew/bin/ghostty, /Applications/Ghostty.app, /usr/local/bin

Fixes Ghostty detection when not in PATH.
Temporarily exempt files with existing sync fs usage to avoid breaking
the build. The rule will still prevent new sync fs usage in other files.

Files exempted:
- src/config.ts (initialization code)
- src/debug/**/*.ts (CLI tools)
- src/git.ts, src/main.ts (bootstrap code)
- src/services/* (existing services)

New code in other locations will be required to use async fs operations.
Ensure Ghostty path detection only matches actual files, not directories
with execute permission (which most directories have for traversal).
Copy link
Member

@ammario ammario left a comment

Choose a reason for hiding this comment

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

Manually tested — no regressions

@ammario ammario enabled auto-merge October 16, 2025 15:28
@ammario ammario added this pull request to the merge queue Oct 16, 2025
Merged via the queue into main with commit 03b3e18 Oct 16, 2025
8 checks passed
@ammario ammario deleted the ghostty-fix branch October 16, 2025 15:42
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