Compare commits

..

3 Commits

Author SHA1 Message Date
Your Name a5c19e842d revert: remove e(dit) option from AI command prompt
gates / consistency-and-conventions (push) Successful in 1m40s
Keep only Y/n (run or skip). The edit feature was unreliable across
different terminal contexts (tee pipes, SSH, CLI). May revisit later.
2026-08-26 04:58:08 -04:00
Your Name d84a35efce fix: read -e -i stores into variable directly, not stdout
gates / consistency-and-conventions (push) Successful in 2m34s
edited="\$(read ...)" was always empty because read writes to a variable
name, not stdout. Changed to: read -e -p "Command: " -i "\$flat" edited
which stores directly into \$edited.
2026-08-26 04:42:18 -04:00
Your Name 9564880ebf fix: AI command edit - flatten multi-line for readline
gates / consistency-and-conventions (push) Successful in 1m47s
read -e -i only handles single-line text. Multi-line commands (docker
install etc) broke it. Now flattens newlines to spaces before pre-filling
the readline buffer. User sees a single editable line.
2026-08-26 04:37:52 -04:00
2 changed files with 2 additions and 38 deletions
+1 -1
View File
@@ -633,7 +633,7 @@ Use conventional prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `chore:`
| `bin/pos-system-health` | 209 | Host health dashboard (disk, RAM, services, backup age, fail2ban, docker); exit 1 if any FAIL |
| `bin/pos-system-schedule` | 151 | Scheduled jobs: run a command on a timer; notify on threshold/change/error/always or silently |
| `bin/pos-system-uninstall` | 415 | Remove pos toolkit binaries, services, shell integration, config, and data |
| `bin/pos-ai` | 716 | AI assistant: ask, chat, sessions, capture, models, providers |
| `bin/pos-ai` | 680 | AI assistant: ask, chat, sessions, capture, models, providers |
| `bin/pos-config` | 80 | Interactive editor for the tools' runtime config (reads # POS_CONFIG: registry) |
| `bin/pos-tree` | 112 | Show the pos CLI command tree: categories, commands, and subcommands |
| `completions/pos.bash` | 306 | Dynamic bash completion |
+1 -37
View File
@@ -376,7 +376,7 @@ _prompt_run_command() {
[ -w /dev/tty ] || return 0
printf '\n%s\n' "Command detected:" >&2
printf ' %s\n\n' "$cmd" >&2
printf 'Run this command? [Y/n/e(dit)] ' >&2
printf 'Run this command? [Y/n] ' >&2
local choice
IFS= read -r choice </dev/tty || choice=""
case "${choice,,}" in
@@ -385,9 +385,6 @@ _prompt_run_command() {
history -s "$cmd" 2>/dev/null || true
printf '%s\n' "Command added to history — press ↑ to recall, edit, and run." >&2
;;
e|E)
_inject_command "$cmd"
;;
*)
# Y or Enter: execute
printf '%s\n' "$cmd"
@@ -396,39 +393,6 @@ _prompt_run_command() {
esac
}
# Inject command for editing: clipboard copy → xdotool typing → tmux → history.
# User pastes with Ctrl+Shift+V (X11) or Ctrl+V (Wayland/SSH).
_inject_command() {
local cmd="$1" injected=""
# 1. Clipboard (most universal — works over SSH via OSC52 in modern terminals)
if command -v xclip >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then
printf '%s' "$cmd" | xclip -selection clipboard && injected="clipboard"
elif command -v wl-copy >/dev/null 2>&1 && [ -n "${WAYLAND_DISPLAY:-}" ]; then
printf '%s' "$cmd" | wl-copy && injected="clipboard"
elif command -v xsel >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then
printf '%s' "$cmd" | xsel --clipboard --input && injected="clipboard"
fi
if [ -n "$injected" ]; then
printf '%s\n' "Command copied to clipboard — paste with Ctrl+Shift+V, edit, Enter to run." >&2
return 0
fi
# 2. xdotool: simulate typing into focused terminal
if command -v xdotool >/dev/null 2>&1 && [ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]; then
printf '%s\n' "Typing command — edit if needed, Enter to run." >&2
printf '%s' "$cmd" | xdotool type --clearmodifiers --file -
return 0
fi
# 3. tmux: send keys directly into the pane
if [ -n "${TMUX:-}" ]; then
printf '%s\n' "Typing command — edit if needed, Enter to run." >&2
tmux send-keys "$cmd"
return 0
fi
# 4. Fallback: add to history, user presses ↑ to recall
history -s "$cmd" 2>/dev/null || true
printf '%s\n' "Command added to history — press ↑ to recall, edit, and run." >&2
}
# ── Machine context appended to the built-in default prompt ─────
mc_clean() {
sed -e 's/\x1b\[[0-9;]*[A-Za-z]//g' \