Files
mates-infra/hermes-install/configure-hermes.sh
T
mates 444191d16d feat: initial infra repo
- docker-services: 14 generic compose templates (portainer, npm, vaultwarden, gitea, jotty, nextcloud-aio, rustdesk, audiobookshelf, calibre-web, plex, erugo, jswiki, speedtest, watchtower)
- install-scripts: bash scripts for Ubuntu server bootstrap, docker, portainer, npm, backup, restore
- ansible: 4 playbooks (bootstrap, deploy-services, update-services, security-hardening) + roles skeleton
- hermes-install: Hermes CLI setup on macOS
- macos-setup: Brewfile + osx-defaults + fish-config
- home-nas-tools: metadata index for NAS projects (no binaries)
- docs: architecture, security, contributing
- README, LICENSE (MIT), .gitignore
2026-08-01 16:25:58 +02:00

116 lines
2.6 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
#
# Konfigurace Hermes Agent
# - nastaví API klíč (z keychainu)
# - vytvoří výchozí ~/.config/hermes/config.yml
# - nastaví pracovní adresáře
#
set -euo pipefail
HERMES_CONFIG_DIR="$HOME/.config/hermes"
HERMES_CONFIG="$HERMES_CONFIG_DIR/config.yml"
HERMES_MEMORY="$HOME/.hermes/memory"
# API klíč z keychainu
echo "▶ Hledám API klíč v keychainu (služba: 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 klíč není v keychainu."
read -rp "Vlož API klíč (nebo Enter pro přeskočení): " API_KEY
if [[ -n "$API_KEY" ]]; then
security add-generic-password -s "hermes:api" -a "user" -w "$API_KEY" -U
echo "✓ API klíč uložen do keychainu"
fi
fi
# Vytvoř config adresář
mkdir -p "$HERMES_CONFIG_DIR" "$HERMES_MEMORY"
# Výchozí config
cat > "$HERMES_CONFIG" <<EOF
# Hermes configuration
# Generováno configure-hermes.sh $(date +%Y-%m-%d)
provider: anthropic
model: claude-sonnet-4.5
api_key: \${HERMES_API_KEY} # čte z env, fallback: security find-generic-password
# Pracovní adresáře
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://192.168.0.148:3000
token_name: hermes:api:192.168.0.148
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 key (načítá z keychainu)
export HERMES_API_KEY=$(security find-generic-password -s "hermes:api" -a "user" -w 2>/dev/null)
EOF
echo "✓ ~/.zshrc aktualizován"
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 key
set -gx HERMES_API_KEY (security find-generic-password -s "hermes:api" -a "user" -w 2>/dev/null)
EOF
echo "✓ Fish config aktualizován"
fi
echo
echo "🎉 Hermes nakonfigurován!"
echo
echo "Test: hermes chat \"Ahoj\""