# Prompt pra Claude Code local (Alacritty Windows) — Setup completo

Contexto: estou no Alacritty 0.17.0 no Windows, conectado via SSH pro
Hetzner (nxt@176.9.9.187) com tmux 3.4 rodando no servidor. Claude Code
CLI 2.1.101 é o que uso pra conversar.

Pesquisa prévia confirmou: 0.17.0 é a última versão (master só tem 1
commit cosmético além de 0.17.0, sem features). Otimizar tudo nela.

QUATRO arquivos de config otimizados já estão no Hetzner (/tmp/):
- /tmp/alacritty-optimized.toml   (180 linhas — Alacritty)
- /tmp/tmux-optimized.conf        (69 linhas — tmux patch)
- /tmp/shell-integration.sh       (48 linhas — OSC 133 pra bash/zsh)
- /tmp/alacritty-hyperlinks.info  (terminfo patched com Hsu3/Hsv2)

Minha missão: ativar todos esses + verificar resultado.

═══════════════════════════════════════════════════════════════════════════════
FASE 1 — Baixar configs do Hetzner pro Windows (via SCP)
═══════════════════════════════════════════════════════════════════════════════

1.1) No PowerShell:
     New-Item -ItemType Directory -Force "$env:APPDATA\alacritty" | Out-Null
     scp nxt@176.9.9.187:/tmp/alacritty-optimized.toml "$env:APPDATA\alacritty\alacritty.toml"

1.2) Verificar arquivo:
     Get-Content "$env:APPDATA\alacritty\alacritty.toml" | Select -First 10
     # Deve mostrar "[general]", "ipc_socket = true", "[env]", "TERM = ..."

═══════════════════════════════════════════════════════════════════════════════
FASE 2 — Instalar JetBrainsMono Nerd Font (recomendada pelo config)
═══════════════════════════════════════════════════════════════════════════════

2.1) scoop bucket add nerd-fonts
     scoop install nerd-fonts/JetBrainsMono-NF

     # OU (se não usa Scoop):
     winget install --id DEVCOM.JetBrainsMonoNerdFont

     # OU manual:
     # https://github.com/ryanoasis/nerd-fonts/releases → JetBrainsMono.zip
     # Extrai e clica direito em cada .ttf → Install

2.2) Confirmar fonte disponível:
     Get-ChildItem "C:\Windows\Fonts\*" -Filter "*JetBrains*"

═══════════════════════════════════════════════════════════════════════════════
FASE 3 — Configurar SSH pra propagar TERM (~/.ssh/config do Windows)
═══════════════════════════════════════════════════════════════════════════════

3.1) Criar/editar $env:USERPROFILE\.ssh\config — adicionar se não tiver:

     Host hetzner
       HostName 176.9.9.187
       User nxt
       SendEnv TERM
       ServerAliveInterval 60
       ServerAliveCountMax 3

3.2) Hosts genéricos (pra qualquer SSH propagar TERM):

     Host *
       SendEnv TERM

═══════════════════════════════════════════════════════════════════════════════
FASE 4 — Aplicar tmux patch no Hetzner (VIA SSH)
═══════════════════════════════════════════════════════════════════════════════

4.1) SSH pro Hetzner:
     ssh hetzner   # ou: ssh nxt@176.9.9.187

4.2) Backup + append do patch:
     cp ~/dotfiles/.tmux.conf ~/dotfiles/.tmux.conf.bak
     cat /tmp/tmux-optimized.conf >> ~/dotfiles/.tmux.conf

4.3) Reload tmux sem matar sessões:
     tmux source ~/.tmux.conf
     # Se estiver em sessão, vai aplicar imediato

4.4) Verificar aplicado:
     tmux show-options -g | grep -E "set-clipboard|allow-passthrough|escape-time|terminal-features|history-limit"
     # Esperado: set-clipboard on, allow-passthrough on, escape-time 0, etc.

═══════════════════════════════════════════════════════════════════════════════
FASE 5 — Shell integration (OSC 133) — OPCIONAL mas recomendado
═══════════════════════════════════════════════════════════════════════════════

5.1) No Hetzner (ainda via SSH):
     # Adicionar ao ~/.zshrc ou ~/.bashrc:
     [ -f /tmp/shell-integration.sh ] && source /tmp/shell-integration.sh

     # OU copiar pra local persistente:
     cp /tmp/shell-integration.sh ~/.config/shell-integration.sh
     echo 'source ~/.config/shell-integration.sh' >> ~/.zshrc

5.2) Aplicar:
     source ~/.zshrc   # ou: exec zsh

═══════════════════════════════════════════════════════════════════════════════
FASE 6 — Reiniciar Alacritty e testar TUDO
═══════════════════════════════════════════════════════════════════════════════

6.1) No Windows: FECHAR TODAS as janelas do Alacritty. Abrir nova.

6.2) SSH pro Hetzner de novo, entrar no tmux (se não entra auto):
     ssh hetzner
     tmux attach -t main   # ou cria nova: tmux new -s work

6.3) Rodar BATERIA de testes:

     # Teste 1 — TERM propagado?
     echo "TERM=$TERM"
     # Esperado: alacritty

     # Teste 2 — Terminfo com hyperlink?
     infocmp -x alacritty | grep -E 'Hsu3|Hsv2|RGB'
     # Esperado: 3 capabilities listadas

     # Teste 3 — OSC 8 (link clicável)
     printf '\e]8;;https://github.com\e\\LINK-DEVE-SUBLINHAR\e]8;;\e\\\n'

     # Teste 4 — OSC 52 (clipboard remoto → Windows)
     printf '\e]52;c;%s\e\\' "$(echo -n 'TESTE_OSC52_NO_CLIPBOARD' | base64)"
     # Agora Ctrl+V em qualquer app Windows deve colar "TESTE_OSC52_NO_CLIPBOARD"

     # Teste 5 — Seleção mouse (shift se tmux interferir)
     # Selecione texto com mouse. Solte. Ctrl+V em Windows → deve colar.

     # Teste 6 — vi-mode no tmux (Prefix + [, depois [ ou ] pula entre prompts)
     # Requer Fase 5 (OSC 133). Prefix+[ entra em copy-mode; ] pula próximo prompt.

═══════════════════════════════════════════════════════════════════════════════
FASE 7 — Se algo falhar, me mostra
═══════════════════════════════════════════════════════════════════════════════

7.1) No Windows:
     alacritty --version
     echo $env:TERM
     Get-Content "$env:APPDATA\alacritty\alacritty.toml" | Measure-Object -Line

7.2) No Hetzner (SSH):
     echo $TERM
     tmux info | head -20
     tmux show-options -g set-clipboard
     infocmp -x $TERM | head -5
     ls ~/.terminfo/a/ 2>/dev/null

═══════════════════════════════════════════════════════════════════════════════
RESUMO DO QUE VAI FUNCIONAR DEPOIS
═══════════════════════════════════════════════════════════════════════════════

[ok] Links [text](url) em markdown clicaveis (OSC 8)
[ok] Ctrl+Click em qualquer URL abre browser (hints regex — fallback)
[ok] Selecionar texto com mouse -> vai pro clipboard do Windows (OSC 52)
[ok] Ctrl+Shift+C/V nativo Alacritty (sem passar por tmux)
[ok] Truecolor (24-bit RGB) em tudo — neovim, bat, lazygit, etc.
[ok] Undercurl (Smulx) pra diagnosticos LSP sublinhados
[ok] Synchronized output (ANSI 2026) — sem flicker em apps modernos
[ok] Prefix+[ -> vi-mode, ] pula pro proximo prompt ([ pro anterior)
[ok] Ctrl+Shift+Space -> vi-mode do Alacritty (search scrollback)
[ok] Ctrl+Shift+F/B -> search forward/backward no scrollback
[ok] Shift+PageUp/Down -> scroll do Alacritty
[ok] history 100k linhas tanto no Alacritty quanto no tmux
[ok] JetBrainsMono Nerd Font com ligatures e icones

Executa fase por fase. Me mostra outputs de cada teste. Se algo falhar,
volta pra fase 7.
