Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
#!/bin/sh
# Autonomous Thinking Desk Display — installer
#
# Installs the desk-display plugin for whichever AI coding agent CLIs you have.
# Both plugins are Python 3 stdlib only; nothing is compiled and nothing is
# downloaded except the plugin source itself.
#
# curl -fsSL https://raw.githubusercontent.com/autonomous-ai/autonomous-desk/main/install.sh | sh
#
# Flags:
# --claude-only install for Claude Code only
# --codex-only install for Codex only
set -eu
REPO_URL="https://github.com/autonomous-ai/autonomous-desk"
MARKETPLACE="autonomous-desk"
PLUGIN="thinking-desk"
OLD_PLUGIN="vibe-desk-display" # renamed in 2026; removed on upgrade
WANT_CLAUDE=1
WANT_CODEX=1
for arg in "$@"; do
case "$arg" in
--claude-only) WANT_CODEX=0 ;;
--codex-only) WANT_CLAUDE=0 ;;
-h|--help) sed -n '2,14p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
*) echo "unknown option: $arg" >&2; exit 2 ;;
esac
done
if [ -t 1 ]; then
B=$(printf '\033[1m'); D=$(printf '\033[2m'); R=$(printf '\033[0m')
else
B=''; D=''; R=''
fi
say() { printf '%s\n' "$*"; }
step() { printf '%s==>%s %s\n' "$B" "$R" "$*"; }
warn() { printf '%s!!%s %s\n' "$B" "$R" "$*" >&2; }
installed_claude=0
installed_codex=0
migrated=0
# The plugin used to be called vibe-desk-display. It is a different plugin id,
# so leaving it installed alongside the new one registers the Stop hook twice
# and you get two cards and two buzzes per finished task.
remove_old_claude() {
# `claude plugin uninstall` fails when the plugin isn't installed, so its
# exit status is a reliable "was it there?".
if claude plugin uninstall "$OLD_PLUGIN" >/dev/null 2>&1; then
step "Removed the old $OLD_PLUGIN plugin (Claude Code)"
migrated=1
fi
}
remove_old_codex() {
# `codex plugin remove` prints "Removed" and exits 0 even for a plugin that
# was never installed, so it cannot tell us anything. The registration in
# config.toml is authoritative — and it is also what survives when
# `codex plugin list` stops listing the plugin after its marketplace entry
# is replaced, leaving the hooks firing invisibly. Match any marketplace.
cfg="${CODEX_HOME:-$HOME/.codex}/config.toml"
[ -f "$cfg" ] || return 0
spec=$(grep -o "^\[plugins\.\"$OLD_PLUGIN@[^\"]*\"\]" "$cfg" 2>/dev/null \
| head -1 | sed 's/^\[plugins\."//; s/"\]$//')
[ -n "$spec" ] || return 0
step "Removing the old $OLD_PLUGIN plugin (Codex)"
if codex plugin remove "$spec" >/dev/null 2>&1; then
migrated=1
else
warn "Could not remove it. Run: codex plugin remove $spec"
fi
}
# --- Claude Code -------------------------------------------------------------
if [ "$WANT_CLAUDE" -eq 1 ] && command -v claude >/dev/null 2>&1; then
step "Claude Code detected — installing $PLUGIN"
remove_old_claude
# --sparse keeps the marketplace checkout to the plugin dirs, skipping the
# CAD/STL/video payload in this repo. Fall back if the flag is unsupported.
# Output is suppressed: for anyone who already has the marketplace, the
# --sparse attempt fails loudly ("network source differs...") even though the
# fallback below is fine. A genuine problem still surfaces at install time.
claude plugin marketplace add "$REPO_URL" --sparse .claude-plugin software/claude-code >/dev/null 2>&1 \
|| claude plugin marketplace add "$REPO_URL" >/dev/null 2>&1 \
|| true
# `add` fails when the marketplace is already configured, and its cached
# manifest may predate the rename — refresh it or the plugin won't be found.
claude plugin marketplace update "$MARKETPLACE" >/dev/null 2>&1 || true
if claude plugin install "$PLUGIN@$MARKETPLACE" -y; then
installed_claude=1
else
warn "Claude Code install failed. Try manually:"
say " claude plugin install $PLUGIN@$MARKETPLACE"
fi
fi
# --- Codex -------------------------------------------------------------------
if [ "$WANT_CODEX" -eq 1 ] && command -v codex >/dev/null 2>&1; then
step "Codex detected — installing $PLUGIN"
remove_old_codex
codex plugin marketplace add "$REPO_URL" --sparse .agents --sparse software/codex >/dev/null 2>&1 \
|| codex plugin marketplace add "$REPO_URL" >/dev/null 2>&1 \
|| true
# Same as above: refresh a marketplace that was already configured.
codex plugin marketplace upgrade "$MARKETPLACE" >/dev/null 2>&1 || true
if codex plugin add "$PLUGIN@$MARKETPLACE"; then
installed_codex=1
else
warn "Codex install failed. Try manually:"
say " codex plugin add $PLUGIN@$MARKETPLACE"
fi
fi
# --- Nothing found -----------------------------------------------------------
if [ "$installed_claude" -eq 0 ] && [ "$installed_codex" -eq 0 ]; then
warn "No supported agent CLI was installed successfully."
say ""
say "This installer needs ${B}claude${R} or ${B}codex${R} on your PATH."
say " Claude Code https://claude.com/claude-code"
say " Codex https://developers.openai.com/codex"
say ""
say "Then re-run this installer."
exit 1
fi
# --- Pair --------------------------------------------------------------------
# Prefer the Claude plugin's pair.py; fall back to the Codex CLI, which has had
# the same two subcommands all along under different names.
paired=0
newest() { ls -td $1 2>/dev/null | head -1; }
pair_now() {
# `curl | sh` leaves stdin pointing at the script itself, so a plain `read`
# sees EOF. Talk to the terminal directly, and skip entirely when there
# isn't one (CI, a pipe, a non-interactive shell).
[ -r /dev/tty ] || return 1
if [ "$installed_claude" -eq 1 ]; then
script=$(newest "$HOME/.claude/plugins/cache/*/$PLUGIN/*/scripts/pair.py")
start="start"; complete="complete"; status="status"
elif [ "$installed_codex" -eq 1 ]; then
script=$(newest "$HOME/.codex/plugins/cache/*/$PLUGIN/*/scripts/desk_display.py")
start="pair-start"; complete="pair-complete"; status=""
fi
[ -n "${script:-}" ] && [ -f "$script" ] || return 1
# Already paired? The config is shared between both agents, so one pairing
# covers Claude Code and Codex.
if [ -n "$status" ] && python3 "$script" "$status" >/dev/null 2>&1; then
say ""
step "A display is already paired — reusing it."
paired=1
return 0
fi
say ""
step "Pairing your display"
python3 "$script" "$start" || return 1
printf ' Enter the 4-digit code (or press Enter to skip): '
read -r code < /dev/tty || return 1
[ -n "$code" ] || return 1
python3 "$script" "$complete" "$code" || return 1
paired=1
}
pair_now || true
# --- Next steps --------------------------------------------------------------
say ""
step "Installed. Three things left:"
say ""
say " ${B}1.${R} Restart your agent (exit and reopen)."
if [ "$installed_codex" -eq 1 ]; then
say ""
say " ${B}2.${R} ${B}Codex only:${R} run ${B}/hooks${R} in the Codex ${B}CLI${R} and trust the plugin's"
say " Stop and PermissionRequest hooks. In the Codex app or IDE chat"
say " ${D}/hooks${R} is an ordinary message and won't open the trust prompt —"
say " run ${B}codex${R} once in a terminal instead. Trust is saved to"
say " ${D}~/.codex/config.toml${R} and applies everywhere after."
fi
if [ "$paired" -eq 1 ]; then
say ""
say " ${B}3.${R} Your display is paired — nothing else to do. One pairing serves"
say " both Claude Code and Codex."
else
say ""
say " ${B}3.${R} Put your desk on the same Wi-Fi, then say: ${B}pair my display${R}"
say " A 4-digit code appears on the display — type it back. You only pair"
say " once; both agents share it."
fi
say ""
if [ "$migrated" -eq 1 ]; then
say ""
say " ${D}Note: the plugin was renamed ${OLD_PLUGIN} -> ${PLUGIN}. The old one was${R}"
say " ${D}removed. Your paired display and settings carry over untouched, but the${R}"
say " ${D}slash commands are now /${PLUGIN}:usage, :insights, :notify.${R}"
fi
say ""
say " ${D}Afterwards, update the desk firmware in the Thinking Desk mobile app.${R}"
say " ${D}Guides: $REPO_URL/tree/main/software${R}"
say ""
3fa451c16This file is pinned to the selected release. Download the original to open it in your design tool.