Files
mates-macos-setup/configure-hermes.sh
T
mates 4340cb3b2a init: clean history with no PII
Toto repo ma novou cistou historii (1 commit). Predchozi historie
byla smazana, protoze obsahovala osobni udaje (IP, emaily, hesla,
klice, tokeny, Volume cesty). Soubory v aktualnim commit uz tyto
udaje neobsahuji (nahradeno placeholdery <server-ip>, CHANGE_ME,
admin@example.com atd.).

Pokud chces zpet kompletni seznam starych commitu, mas je ve svem
lokalnim working tree - git log --all ukaze prazdno (protoze jsme
smazali .git/ a zacali znovu).
2026-08-01 19:51:59 +02:00

116 lines
2.5 KiB
Bash

#!/usr/bin/env bash
#
# Konfigurace Hermes Agent
# - nastavi API klic (z keychainu)
# - vytvori vychozi ~/.config/hermes/config.yml
# - nastavi pracovni adresare
#
set -euo pipefail
HERMES_CONFIG_DIR="$HOME/.config/hermes"
HERMES_CONFIG="$HERMES_CONFIG_DIR/config.yml"
HERMES_MEMORY="$HOME/.hermes/memory"
# API klic z keychainu
echo "Hledam API klic v keychainu (sluzba: hermes:api)..."
API_KEY=$(security find-generic-password -s "hermes:api" -a "user" -w 2>/dev/null || true)
if [[ -z "$API_KEY" ]]; then
echo "API klic neni v keychainu."
read -rp "Vloz API klic (nebo Enter pro preskoceni): " API_KEY
if [[ -n "$API_KEY" ]]; then
security add-generic-password -s "hermes:api" -a "user" -w "$API_KEY" -U
echo "API klic ulozen do keychainu"
fi
fi
# Vytvor config adresar
mkdir -p "$HERMES_CONFIG_DIR" "$HERMES_MEMORY"
# Vychozi config
cat > "$HERMES_CONFIG" <<EOF
# Hermes configuration
# Vygenerovano configure-hermes.sh - $(date +%Y-%m-%d)
provider: anthropic
model: claude-sonnet-4.5
api_key: \${HERMES_API_KEY} # cte z env, fallback: security find-generic-password
# Pracovni adresare
workspace: ~/Skripty
memory_dir: $HERMES_MEMORY
# Sandbox
sandbox:
enabled: true
allow:
- "ls"
- "cat"
- "grep"
- "find"
- "git"
- "docker"
- "docker compose"
- "kubectl"
- "ssh"
- "scp"
- "rsync"
- "curl"
- "jq"
deny:
- "rm -rf /"
- "rm -rf /*"
- "dd if="
- "mkfs"
- ":(){:|:&};:"
# Integrace
integrations:
gitea:
url: http://<server-ip>:3000
token_name: hermes:api:<server-ip>
docker:
socket: /var/run/docker.sock
git:
user_name: "Hermes Agent"
user_email: "hermes@localhost"
# Output
output:
format: markdown
streaming: true
language: cs
# UI
ui:
theme: dark
icons: emoji
EOF
# Environment v shellu
SHELL_RC="$HOME/.zshrc"
if ! grep -q "HERMES_API_KEY" "$SHELL_RC" 2>/dev/null; then
cat >> "$SHELL_RC" <<'EOF'
# Hermes Agent API klic (nacita z keychainu)
export HERMES_API_KEY=$(security find-generic-password -s "hermes:api" -a "user" -w 2>/dev/null)
EOF
echo "~/.zshrc aktualizovan"
fi
# Fish varianta
FISH_CONFIG="$HOME/.config/fish/config.fish"
if [[ -f "$FISH_CONFIG" ]] && ! grep -q "HERMES_API_KEY" "$FISH_CONFIG" 2>/dev/null; then
cat >> "$FISH_CONFIG" <<'EOF'
# Hermes Agent API klic
set -gx HERMES_API_KEY (security find-generic-password -s "hermes:api" -a "user" -w 2>/dev/null)
EOF
echo "Fish config aktualizovan"
fi
echo
echo "Hermes nakonfigurovan!"
echo
echo "Test: hermes chat \"Ahoj\""