Files
devdesk/libexec/devdesk-session-hook
T
jaredandClaude Opus 5.5 74927a7640
build-deb / Lint, test, package (push) Successful in 3m53s
build-deb / Deploy to CT 126 (push) Successful in 10s
build-deb / Notify on failure (push) Skipped
fix: v0.9.1 robustness cleanups
- run_resume falls back to a new conversation only when the transcript file
  is gone; other failures end at the menu with the recorded id intact.
- The SessionStart hook resolves the session name under the registry lock;
  rename holds it across tmux rename-session and the registry move
  (dd_registry_locked, nestable).
- dd_load_env parses KEY=value like systemd instead of sourcing the files.
- devdesk-deploy: DPkg::Lock::Timeout, explicit FAILED lines on stdout and in
  the log; the hook answers synchronously and CI checks the HTTP status.
  logrotate for the deploy log.
- postinst drops duplicate terminal-features entries; hooks sweep stale
  temp files.

Closes #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 01:01:51 -04:00

27 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Claude Code SessionStart hook (wired in via claude-settings.json). Records the
# Claude session ID for the DevDesk session this Claude runs in, so that after a
# reboot devdesk-claude-run can `claude --resume` exactly this conversation.
# Fires on startup, resume, /clear and /compact. Must never block Claude.
# shellcheck source=libexec/devdesk-lib.sh
. "${DEVDESK_LIBEXEC:-/usr/lib/devdesk}/devdesk-lib.sh" || exit 0
input=$(cat)
id=$(jq -r '.session_id // empty' <<<"$input" 2>/dev/null)
source=$(jq -r '.source // empty' <<<"$input" 2>/dev/null)
[ -n "$id" ] || exit 0
# The session's name is read under the registry lock: a rename holds it too,
# so the id can't land under the old name after the entry moved.
# shellcheck disable=SC2317 # called through dd_registry_locked
record() {
local session
session=$(dd_current_session)
if [ -z "$session" ] || ! dd_valid_name "$session"; then return 0; fi
dd_registry_set_claude "$session" "$id" "$source"
}
dd_registry_locked record 2>/dev/null
dd_sweep_tmp
exit 0