feat: v0.8.2 clickable paths, alert sessions, ops guard and trail
build-deb / Lint, test, package (push) Successful in 2m45s
build-deb / Deploy to CT 126 (push) Successful in 5s
build-deb / Notify on failure (push) Skipped

- Terminal link provider: printed paths that are files of the session open
  in Files (at the line); the file list is preloaded so the first hover works.
- Alerts: "In a new session" opens alert-<name> and types the prompt once
  Claude is up.
- devdesk-guard PreToolUse(Bash) hook: permissionDecision "ask" for
  destructive commands (verified to prompt in auto mode); DEVDESK_GUARD and
  guard.local.
- State hook logs Bash commands and derives host tags (ssh targets, CT/VM
  ids); --list carries tags, --peek the last commands; UI shows both.

Closes #21
Closes #18
Closes #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 20:37:46 -04:00
co-authored by Claude Opus 5.5
parent a92d10ace3
commit f82c13612d
21 changed files with 389 additions and 23 deletions
+30
View File
@@ -36,6 +36,36 @@ PostToolUse:Edit | PostToolUse:Write | PostToolUse:MultiEdit | PostToolUse:Noteb
fi
;;
esac
# Ops trail (devdesk#27): every Bash command, and the hosts a session works on
# (ssh targets, Proxmox CT/VM ids) as tags for the session list.
if [ "$event:$tool" = PostToolUse:Bash ]; then
cmd=$(jq -rM '.tool_input.command // empty' <<<"$input" 2>/dev/null)
if [ -n "$cmd" ]; then
base="${DEVDESK_STATE_DIR:-/var/lib/devdesk}"
mkdir -p "$base/commands" "$base/tags" 2>/dev/null
log="$base/commands/$session.jsonl"
jq -cMn --arg c "${cmd:0:500}" '{at: (now | floor), cmd: $c}' >>"$log" 2>/dev/null
if [ "$(wc -l <"$log" 2>/dev/null || echo 0)" -gt 600 ]; then
tail -n 500 "$log" >"$log.tmp" 2>/dev/null && mv -f "$log.tmp" "$log"
fi
hosts=$(
# ssh [options] [user@]host: the first word that isn't an option (or an option's value)
awk '{ for (i = 1; i <= NF; i++) if ($i == "ssh") { j = i + 1
while (j <= NF && $j ~ /^-/) { if ($j ~ /^-[bcDEeFIiJLlmOopQRSWw]$/) j++; j++ }
if (j <= NF) { h = $j; sub(/^[^@]*@/, "", h); gsub(/[^A-Za-z0-9_.-].*$/, "", h); if (h != "") print h } } }' <<<"$cmd"
grep -oE '\bpct[[:space:]]+(exec|enter|push|pull|config|set|start|stop|shutdown|reboot|status|snapshot|rollback|migrate)[[:space:]]+[0-9]{3,}' <<<"$cmd" | grep -oE '[0-9]+$' | sed 's/^/CT /'
grep -oE '\bqm[[:space:]]+(guest[[:space:]]+exec|terminal|config|set|start|stop|shutdown|reboot|status|snapshot|rollback|migrate)[[:space:]]+[0-9]{3,}' <<<"$cmd" | grep -oE '[0-9]+$' | sed 's/^/VM /'
)
if [ -n "$hosts" ]; then
tags="$base/tags/$session.json"
jq -cMn --rawfile new <(printf '%s\n' "$hosts") --slurpfile old <(cat "$tags" 2>/dev/null || echo '{}') '
($new | split("\n") | map(select(length > 0))) as $n
| {hosts: ($n + ($old[0].hosts // []) | reduce .[] as $h ([]; if index([$h]) then . else . + [$h] end) | .[:4]),
at: (now | floor)}' >"$tags.tmp" 2>/dev/null && mv -f "$tags.tmp" "$tags"
fi
fi
fi
case $event in
UserPromptSubmit | PostToolUse) state=working ;;
Notification | PermissionRequest) state=waiting ;;