-
Notifications
You must be signed in to change notification settings - Fork 0
feat(fish): add clrc command for stable claude remote-control #1204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||||||||||||||||||||||||||||
| function _clrc_function --description "Run Claude Code remote-control with a stable binary, immune to bun updates while running" | ||||||||||||||||||||||||||||||||
| # Resolve the symlink to the real inode before starting. | ||||||||||||||||||||||||||||||||
| # When bun replaces the file (creates a new inode), the running node process | ||||||||||||||||||||||||||||||||
| # keeps its reference to the old inode and is unaffected. | ||||||||||||||||||||||||||||||||
| # Usage: clrc [<claude remote-control args...>] | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| set -l claude_real (realpath (which claude)) | ||||||||||||||||||||||||||||||||
| node $claude_real remote-control $argv | ||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Inspect current clrc resolution flow and related tests.
rg -n -C3 'which claude|realpath|node \$claude_real remote-control' home-manager/programs/fish/functions/_clrc_function.fish
rg -n -C3 '_clrc_function|remote-control|which|realpath|node' spec/fish/_clrc_function_test.fishRepository: shunkakinoki/dotfiles Length of output: 1200 🏁 Script executed: #!/bin/bash
# Verify Fish shell behavior for failed command substitution
# Check if there are similar error-handling patterns elsewhere in the codebase
# 1. Test Fish behavior when which fails
fish -c 'which nonexistent_command_xyz; echo "Exit code: $status"'
# 2. Look for other error handling patterns in Fish functions
fd -t f '\.fish$' home-manager/programs/fish/functions/ -x grep -l 'if.*test' {} \; | head -5
rg -n 'if.*test.*-z|if.*which|if.*realpath' home-manager/programs/fish/functions/ -A 2 | head -30
# 3. Check spec file for error case tests
cat spec/fish/_clrc_function_test.fishRepository: shunkakinoki/dotfiles Length of output: 3156 Add guards for If Proposed fix- set -l claude_real (realpath (which claude))
- node $claude_real remote-control $argv
+ set -l claude_bin (which claude 2>/dev/null)
+ if test -z "$claude_bin"
+ echo "clrc: claude not found in PATH" >&2
+ return 127
+ end
+
+ set -l claude_real (realpath $claude_bin 2>/dev/null)
+ if test -z "$claude_real"
+ echo "clrc: failed to resolve claude path: $claude_bin" >&2
+ return 1
+ end
+
+ node $claude_real remote-control $argv📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| set fn (status dirname)/../../home-manager/programs/fish/functions | ||
| source $fn/_clrc_function.fish | ||
|
|
||
| # ── basic: resolves symlink and runs node with remote-control ── | ||
| set log1 (mktemp) | ||
| set fake_cli (mktemp) | ||
|
|
||
| function which; echo $fake_cli; end | ||
| function realpath; echo $argv[1]; end | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This test never distinguishes Prompt for AI agents |
||
| function node; echo "node" $argv >> $log1; end | ||
|
Comment on lines
+8
to
+10
|
||
|
|
||
| _clrc_function | ||
|
|
||
| @test "calls node directly (not claude symlink)" (grep -c "^node" $log1) -ge 1 | ||
| @test "passes remote-control subcommand" (grep -c "remote-control" $log1) -ge 1 | ||
|
|
||
| # ── with args: passes through extra args ────────────────────── | ||
| set log2 (mktemp) | ||
| function node; echo "node" $argv >> $log2; end | ||
|
|
||
|
|
||
| _clrc_function --name mysession | ||
|
|
||
| @test "passes extra args through" (grep -c -- "--name" $log2) -ge 1 | ||
| @test "still includes remote-control with args" (grep -c "remote-control" $log2) -ge 1 | ||
|
|
||
| rm -f $log1 $log2 $fake_cli | ||
|
Comment on lines
+4
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test structure can be improved for better isolation and clarity. Redefining the Additionally, the tests can be made more specific by checking for an exact count ( |
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Resolve
claudewith a path-only lookup.whichcan be shadowed by a fish function, causingrealpathto receive non-path output and breakingclrc.Prompt for AI agents