Skip to content

refactor: shorten Raycast binary lookup and tidy sources - #7

Merged
softmaxe merged 1 commit into
mainfrom
claude/nice-hopper-g252lk
Oct 15, 2026
Merged

softmaxe merged 1 commit into
mainfrom
claude/nice-hopper-g252lk

Conversation

@softmaxe

Copy link
Copy Markdown
Owner

Summary

Maintenance pass looking for unnecessary tests and code that is hard to maintain long-term. The repo is already lean (the demo was removed in #5), so the changes are small:

  • raycast/ — each of the five scripts carried the same 20-line binary lookup (an if/elif chain plus a for loop over candidates). It is replaced with path+=(...) + whence -p ferry, so each script drops from 39 to 24 lines. Scripts stay self-contained so the README's "copy the five files" / "copy a script for Space 6+" workflow still works. Lookup order is unchanged: FERRY_BINARY → inherited PATH → /opt/homebrew/bin → /usr/local/bin → ~/.local/bin → build/ next to raycast/. The missing-binary message and exit status 127 are unchanged.
  • src/ferry.m — g_verbose was a file-scope global used only inside main; it is now a local.
  • tests/follow.m — names the fullscreen space type (SPACE_TYPE_FULLSCREEN) instead of using the literal 4 twice, matching ferry.m.

Reviewed and kept

  • tests/cli.sh: each case covers a distinct argument-parsing branch (non-numeric, zero, overflow, missing value, unknown option, extra index). None are redundant.
  • tests/follow.m: manual-only, but it is the only test of real move and Follow behavior (the issue docs: default version bump to patch in AGENTS.md #2 regression).
  • macho_find_symbol and the focus code mirror yabai and stay as they are, per AGENTS.md "upstream first".

Test plan

  • Ran a Raycast script under zsh with stub binaries for each lookup case: nothing found (exit 127 + message), build/ fallback, ~/.local/bin beating build/, PATH beating fallbacks, FERRY_BINARY winning, a missing FERRY_BINARY erroring, and invocation from another cwd. All match the old order.
  • The .m changes could not be compiled locally (Linux container). CI builds them on macOS 26 with -Werror.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P1i79aMaG5M7eTyaXZuVS9


Generated by Claude Code

- raycast: replace the hand-written candidate loop in all five scripts
  with path+= and whence -p. Lookup order is unchanged: FERRY_BINARY,
  the inherited PATH, /opt/homebrew/bin, /usr/local/bin,
  ~/.local/bin, then build/ next to raycast/.
- src/ferry.m: make the verbose flag a local in main instead of a
  file-scope global.
- tests/follow.m: name the fullscreen space type instead of using 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1i79aMaG5M7eTyaXZuVS9
@softmaxe
softmaxe merged commit e88d3eb into main Oct 15, 2026
4 checks passed
@softmaxe
softmaxe deleted the claude/nice-hopper-g252lk branch October 15, 2026 05:45
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