feat(fish): complete Fish shell adapter with full feature parity#58
feat(fish): complete Fish shell adapter with full feature parity#58lacymorrow wants to merge 1 commit into
Conversation
Expands the existing Fish shell skeleton into a fully-featured adapter matching the Bash adapter's capabilities: session commands (/new, /resume), user-facing commands (mode, tool, ask, quit), agent/shell bypass prefixes (@ and !), tab completions, all 10 supported AI tools, and cleanup/quit.
There was a problem hiding this comment.
Code Review
This pull request adds support for the Fish shell (3.1+) by implementing a native adapter for natural language detection, execution routing, and keybindings. The update includes new Fish-specific library files, documentation updates, and expanded CLI completions. Feedback identifies critical bugs in the cleanup routine, specifically that Enter keybindings and original user functions are not restored, which could break the shell. Other improvements suggested include refining the input classification heuristic to handle multiple spaces and ensuring the "ask" command supports multi-word queries.
| bind --erase \n 2>/dev/null | ||
| bind --erase \r 2>/dev/null |
There was a problem hiding this comment.
| # Remove user-facing command functions | ||
| functions --erase mode 2>/dev/null | ||
| functions --erase tool 2>/dev/null | ||
| functions --erase ask 2>/dev/null | ||
| functions --erase quit 2>/dev/null | ||
| functions --erase stop 2>/dev/null |
There was a problem hiding this comment.
The fish_user_key_bindings function was wrapped in lib/fish/keybindings.fish but is not restored during cleanup. This leaves a broken function that attempts to call the erased _lacy_setup_bindings function. You should restore the original function if it was backed up.
# Restore original keybindings function if we wrapped it
if functions -q _lacy_original_key_bindings
functions -c _lacy_original_key_bindings fish_user_key_bindings
functions --erase _lacy_original_key_bindings
end
# Remove user-facing command functions
functions --erase mode tool ask quit stop 2>/dev/null
|
|
||
| # Auto mode — apply heuristics | ||
| # Split into words | ||
| set -l words (string split ' ' -- "$input") |
There was a problem hiding this comment.
Using string split ' ' will include empty strings in the result if the input contains multiple consecutive spaces (e.g., ls -la). This can cause the word_count and the bare word heuristic (lines 105-112) to behave incorrectly, potentially routing valid shell commands to the agent. Use the -n (or --no-empty) flag to skip empty results.
set -l words (string split -n ' ' -- "$input")
| end | ||
|
|
||
| function ask --description "Lacy: send a query directly to the AI agent" | ||
| _lacy_query_agent "$argv" |
There was a problem hiding this comment.
Summary
Closes #36. Completes the Fish shell adapter (Fish 3.1+) with full feature parity against the Bash adapter:
_lacy_classify_inputwith all ~150 agent words, shell reserved words,@/!bypass prefixes, env-var assignment handling, and multi-word heuristics/new,/reset,/clear,/resume), emergency/agent bypass prefixesmode,tool,ask,quit/stop— all available as Fish functionslacy,mode, andtoolcommandsbind \r, Ctrl+Space mode toggle, coexists with user'sfish_user_key_bindingsfish_right_prompt(wraps existing right prompt if present)Also updates
bin/lacy completions fish, README, CLAUDE.md, and docs to reflect Fish support.Test plan
lacy.plugin.fishls -la→ shell,what files are here→ agent/newand/resumesession commands!cmdbypass sends directly to shell@querybypass sends directly to agentmode shell,mode agent,mode autocommandstoolshows installed tools,tool set claudeswitchesask "question"routes to agentquitcleans up bindings and restores promptlacy completions fishoutputs valid completions script