-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlacy.plugin.bash
More file actions
75 lines (63 loc) · 1.77 KB
/
lacy.plugin.bash
File metadata and controls
75 lines (63 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
# Lacy Shell - Smart shell plugin with MCP support (Bash adapter)
# Prevent multiple sourcing
if [[ "${LACY_SHELL_LOADED:-}" == "true" ]]; then
return 0
fi
LACY_SHELL_LOADED=true
export LACY_SHELL_ACTIVE=1
# Plugin directory
LACY_SHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Shell type identification (used by shared core)
LACY_SHELL_TYPE="bash"
_LACY_ARR_OFFSET=0
# Load shared core + Bash adapter modules
source "$LACY_SHELL_DIR/lib/bash/init.bash" || {
LACY_SHELL_LOADED=false
return 1
}
# Initialize
lacy_shell_init() {
# Performance optimization: Initialize caches early
lacy_shell_init_detection_cache
lacy_shell_load_config
lacy_shell_setup_keybindings
lacy_shell_init_mcp
lacy_preheat_init
lacy_shell_setup_prompt
lacy_shell_init_mode
lacy_shell_setup_interrupt_handler
lacy_shell_setup_eof_handler
}
# Cleanup
lacy_shell_cleanup() {
lacy_stop_spinner 2>/dev/null
lacy_preheat_cleanup
lacy_shell_cleanup_mcp
lacy_shell_cleanup_keybindings_bash
trap - INT
unset IGNOREEOF
# Restore original PROMPT_COMMAND
if [[ -n "$_LACY_ORIGINAL_PROMPT_COMMAND" ]]; then
PROMPT_COMMAND="$_LACY_ORIGINAL_PROMPT_COMMAND"
else
PROMPT_COMMAND=""
fi
LACY_SHELL_QUITTING=false
LACY_SHELL_ENABLED=false
LACY_SHELL_LOADED=false
unset LACY_SHELL_ACTIVE
}
# Set up PROMPT_COMMAND for post-execution hooks
_LACY_ORIGINAL_PROMPT_COMMAND="${PROMPT_COMMAND:-}"
if [[ -n "$PROMPT_COMMAND" ]]; then
PROMPT_COMMAND="lacy_shell_precmd_bash; ${PROMPT_COMMAND}"
else
PROMPT_COMMAND="lacy_shell_precmd_bash"
fi
# Initialize
lacy_shell_init
# One-time install tracking (background, fail-silent)
_lacy_track_first_load
# Cleanup on exit
trap lacy_shell_cleanup EXIT