sync: auto-sync from GURU-BEAST-ROG at 2026-07-10 10:06:22

Author: Mike Swanson
Machine: GURU-BEAST-ROG
Timestamp: 2026-07-10 10:06:22
This commit is contained in:
Winter Williams
2026-07-10 10:07:09 -07:00
committed by ClaudeTools Bot
parent 3286a47090
commit 07404759f3
3 changed files with 64 additions and 12 deletions

View File

@@ -35,12 +35,36 @@ export VAULT_ROOT=$(jq -r '.vault_path // empty' "$_identity" 2>/dev/null)
export SYNCRO_USER=$(jq -r '.user // empty' "$_identity" 2>/dev/null)
# Per-user token — attribution in Syncro depends on using the right one.
case "$SYNCRO_USER" in
mike) _vault_path="msp-tools/syncro" ;;
howard) _vault_path="msp-tools/syncro-howard" ;;
*) echo "[WARNING] No Syncro key vaulted for user '$SYNCRO_USER' — enrichment skipped" >&2
return 1 2>/dev/null || exit 1 ;;
esac
# Map a user name to their vaulted key path; empty = no key vaulted for them.
_syncro_key_path() {
case "$1" in
mike) echo "msp-tools/syncro" ;;
howard) echo "msp-tools/syncro-howard" ;;
winter) echo "msp-tools/syncro-winter" ;;
*) echo "" ;;
esac
}
# Prefer the requester's key when running on someone's behalf (e.g. the Discord
# bot sets CLAUDETOOLS_REQUESTER_USER per thread) so Syncro attributes actions
# to the person who asked. Fall back to the identity.json user when the
# requester has no vaulted key (e.g. rob) — never hard-fail on the preference.
_vault_path=""
_requester="${CLAUDETOOLS_REQUESTER_USER:-}"
if [ -n "$_requester" ] && [ "$_requester" != "$SYNCRO_USER" ]; then
_req_path=$(_syncro_key_path "$_requester")
if [ -n "$_req_path" ]; then
_vault_path="$_req_path"
export SYNCRO_USER="$_requester"
echo "[INFO] Using Syncro key for requester '$_requester' (attribution)" >&2
fi
fi
[ -z "$_vault_path" ] && _vault_path=$(_syncro_key_path "$SYNCRO_USER")
if [ -z "$_vault_path" ]; then
echo "[WARNING] No Syncro key vaulted for user '$SYNCRO_USER' — enrichment skipped" >&2
return 1 2>/dev/null || exit 1
fi
SYNCRO_API_KEY=$(bash "$CLAUDETOOLS_ROOT/.claude/scripts/vault.sh" \
get-field "$_vault_path" credentials.credential 2>/dev/null | tail -1)
@@ -53,5 +77,6 @@ if [ -z "$SYNCRO_API_KEY" ]; then
return 1 2>/dev/null || exit 1
fi
unset _syncro_env_dir _identity _root_override _vault_path
unset _syncro_env_dir _identity _root_override _vault_path _requester _req_path
unset -f _syncro_key_path
return 0 2>/dev/null || true