chiefwiggum 1.2.8 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/chiefwiggum +52 -11
  2. package/package.json +1 -1
package/chiefwiggum CHANGED
@@ -100,25 +100,66 @@ ask_choice() {
100
100
  local prompt="$1"
101
101
  shift
102
102
  local options=("$@")
103
+ local selected=0
104
+ local key
103
105
 
104
106
  echo ""
105
107
  echo -e "${BOLD}${prompt}${NC}"
106
108
  echo ""
107
109
 
108
- local i=1
109
- for opt in "${options[@]}"; do
110
- echo -e " ${CYAN}${i})${NC} ${opt}"
111
- ((i++))
112
- done
113
- echo ""
110
+ # Hide cursor
111
+ tput civis 2>/dev/null
112
+
113
+ # Draw menu with current selection highlighted
114
+ draw_menu() {
115
+ for i in "${!options[@]}"; do
116
+ tput el 2>/dev/null # Clear line
117
+ if [ "$i" -eq "$selected" ]; then
118
+ echo -e " ${CYAN}▸${NC} ${BOLD}${options[$i]}${NC}"
119
+ else
120
+ echo -e " ${options[$i]}"
121
+ fi
122
+ done
123
+ }
124
+
125
+ draw_menu
114
126
 
115
127
  while true; do
116
- read -rp "Enter choice [1-${#options[@]}]: " choice
117
- if [[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 1 ] && [ "$choice" -le "${#options[@]}" ]; then
118
- return $((choice - 1))
119
- fi
120
- echo -e "${RED}Invalid choice. Please enter 1-${#options[@]}${NC}"
128
+ read -rsn1 key
129
+
130
+ case "$key" in
131
+ $'\x1b') # Escape sequence (arrow keys)
132
+ read -rsn2 key
133
+ case "$key" in
134
+ '[A'|'OA') # Up arrow
135
+ ((selected > 0)) && ((selected--))
136
+ ;;
137
+ '[B'|'OB') # Down arrow
138
+ ((selected < ${#options[@]} - 1)) && ((selected++))
139
+ ;;
140
+ esac
141
+ ;;
142
+ 'k') # Vim up
143
+ ((selected > 0)) && ((selected--))
144
+ ;;
145
+ 'j') # Vim down
146
+ ((selected < ${#options[@]} - 1)) && ((selected++))
147
+ ;;
148
+ '') # Enter key
149
+ break
150
+ ;;
151
+ esac
152
+
153
+ # Move cursor back up and redraw
154
+ tput cuu ${#options[@]} 2>/dev/null
155
+ draw_menu
121
156
  done
157
+
158
+ # Show cursor again
159
+ tput cnorm 2>/dev/null
160
+ echo ""
161
+
162
+ return $selected
122
163
  }
123
164
 
124
165
  ask_text() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chiefwiggum",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Autonomous coding agent CLI. Point it at a plan, watch it build.",
5
5
  "bin": {
6
6
  "chiefwiggum": "./chiefwiggum"