Add Claude Agent LXC setup and workflow scripts

- Create LXC 171 (claude-agent) on pveelite with Ubuntu 24.04
- Install Node.js 20.x, Claude Code, tmux, Tailscale
- Configure SSH access and Gitea integration
- Add workflow scripts: start-agent.sh, work.sh, new-task.sh, finish-task.sh
- Add code-server for mobile file browsing
- Document complete setup in proxmox/claude-agent/README.md

LXC Details:
- IP internal: 10.0.20.171
- IP Tailscale: 100.95.55.51
- code-server: port 8080

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Marius
2025-12-31 18:53:23 +02:00
parent f01341a707
commit 594b77e449
6 changed files with 522 additions and 0 deletions

View File

@@ -0,0 +1,202 @@
# Claude Agent LXC - Documentație
## Informații Container
| Parametru | Valoare |
|-----------|---------|
| VMID | 171 |
| Hostname | claude-agent |
| IP intern | 10.0.20.171 |
| IP Tailscale | 100.95.55.51 |
| Host Proxmox | pveelite (10.0.20.202) |
| User | claude |
| Storage | local-zfs (32GB) |
| RAM | 4GB |
| CPU | 2 cores |
## Componente Instalate
- Ubuntu 24.04 LTS
- Node.js v20.x (via nvm)
- Claude Code
- tmux
- Git (configurat pentru Gitea)
- Tailscale
## Conectare
### De pe calculator (rețea internă)
```bash
ssh claude@10.0.20.171
```
### De pe telefon/exterior (Tailscale)
```bash
ssh claude@100.95.55.51
```
### VS Code Remote SSH
Config în `~/.ssh/config`:
```
Host claude-agent
HostName 10.0.20.171
User claude
```
## Scripturi Workflow
### start-agent.sh
Pornește sau se atașează la sesiunea tmux "agent".
```bash
~/start-agent.sh
```
### work.sh (recomandat)
Meniu interactiv pentru workflow complet:
- Listează proiectele disponibile în /workspace
- Permite crearea de branch-uri noi
- Continuarea pe branch-uri existente
- Finalizare task (commit + push)
- Vizualizare branch-uri
```bash
~/work.sh
```
### new-task.sh
Creează branch nou pentru un task (hardcodat pentru romfastsql).
```bash
~/new-task.sh fix/nume-bug
```
### finish-task.sh
Finalizează task-ul curent (commit + push).
```bash
~/finish-task.sh
```
## Workflow Complet
### De pe telefon (JuiceSSH + Tailscale)
1. Conectează-te la `100.95.55.51` cu user `claude`
2. Rulează:
```bash
~/start-agent.sh # pornește tmux
~/work.sh # meniu interactiv
```
3. Alege proiectul
4. Alege acțiunea (task nou / continuă / finalizează)
5. Lucrează cu Claude Code
6. Când termini: `~/work.sh` → opțiunea 3 (finalizează)
### De pe calculator (VS Code)
1. VS Code → Remote SSH → `claude-agent`
2. Open Folder → `/workspace/<proiect>`
3. Terminal → `source ~/.nvm/nvm.sh && claude`
## Structura Directoare pe LXC
```
/home/claude/
├── .ssh/
│ ├── authorized_keys # Chei SSH pentru acces
│ ├── gitea_ed25519 # Cheie pentru Gitea
│ └── config # Config SSH pentru Gitea
├── .nvm/ # Node Version Manager
├── .claude/
│ └── settings.json # Permisiuni Claude Code
├── .tmux.conf # Configurare tmux
├── start-agent.sh -> /workspace/start-agent.sh
└── work.sh -> /workspace/work.sh
/workspace/
├── start-agent.sh # Script pornire tmux
├── work.sh # Script workflow interactiv
├── new-task.sh # Script creare branch
├── finish-task.sh # Script finalizare task
├── CLAUDE.md # Info agent
├── SETUP-COMPLETE.md # Documentație setup
├── romfastsql/ # Proiect clonat
└── test/ # Alte proiecte
```
## Comenzi tmux Utile
| Comandă | Acțiune |
|---------|---------|
| `Ctrl+A, d` | Detașare din sesiune |
| `Ctrl+A, c` | Fereastră nouă |
| `Ctrl+A, n` | Fereastră următoare |
| `Ctrl+A, p` | Fereastră anterioară |
| `Ctrl+A, [` | Mod scroll (q pentru ieșire) |
| `tmux attach -t agent` | Reatașare la sesiune |
| `tmux ls` | Listare sesiuni |
## Git / Gitea
### Clonare proiect nou
```bash
cd /workspace
git clone git@gitea.romfast.ro:romfast/<nume-repo>.git
```
### Workflow branch-uri
```bash
git checkout main
git pull
git checkout -b feature/nume-feature
# ... lucrezi ...
git add .
git commit -m "descriere"
git push -u origin feature/nume-feature
# Creează Pull Request în Gitea
```
## Troubleshooting
### Claude Code nu pornește
```bash
source ~/.nvm/nvm.sh
which claude
claude --version
```
### tmux nu găsește sesiunea
```bash
tmux ls
tmux new -s agent -c /workspace
```
### Git clone eșuează
```bash
# Testează conexiunea SSH la Gitea
ssh -T git@gitea.romfast.ro
```
### Tailscale nu funcționează
```bash
sudo systemctl status tailscaled
sudo tailscale status
tailscale ip
```
## Instalare pe LXC nou
Scripturile pot fi copiate pe un LXC nou:
```bash
scp proxmox/claude-agent/*.sh claude@<ip>:/workspace/
ssh claude@<ip> "chmod +x /workspace/*.sh"
ssh claude@<ip> "ln -s /workspace/start-agent.sh ~/start-agent.sh"
ssh claude@<ip> "ln -s /workspace/work.sh ~/work.sh"
```
---
**Data setup:** 2025-12-31
**Ultima actualizare:** 2025-12-31

View File

@@ -0,0 +1,31 @@
#!/bin/bash
# Script pentru a finaliza un task (commit + push)
PROJECT_DIR="/workspace/romfastsql"
cd "$PROJECT_DIR" || exit 1
BRANCH=$(git branch --show-current)
if [ "$BRANCH" = "main" ]; then
echo "❌ Ești pe main! Nu face commit direct pe main."
exit 1
fi
echo "📋 Status curent:"
git status --short
echo ""
read -p "Mesaj commit: " COMMIT_MSG
if [ -z "$COMMIT_MSG" ]; then
echo "❌ Trebuie să dai un mesaj pentru commit"
exit 1
fi
git add .
git commit -m "$COMMIT_MSG"
git push -u origin "$BRANCH"
echo ""
echo "✅ Done! Branch-ul $BRANCH a fost push-uit."
echo "🔗 Creează Pull Request în Gitea: https://gitea.romfast.ro/romfast/romfastsql/compare/main...$BRANCH"

View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Script pentru a începe un task nou cu branch
if [ -z "$1" ]; then
echo "Utilizare: ~/new-task.sh <nume-branch>"
echo "Exemplu: ~/new-task.sh fix/rezolva-bug"
exit 1
fi
BRANCH_NAME="$1"
PROJECT_DIR="/workspace/romfastsql"
cd "$PROJECT_DIR" || exit 1
# Actualizează main
echo "📥 Actualizez main..."
git checkout main
git pull origin main
# Creează branch nou
echo "🌿 Creez branch: $BRANCH_NAME"
git checkout -b "$BRANCH_NAME"
echo "✅ Gata! Ești pe branch-ul: $BRANCH_NAME"
echo ""
echo "Pornește Claude cu: source ~/.nvm/nvm.sh && claude"

View File

@@ -0,0 +1,17 @@
#!/bin/bash
# Start or attach to Claude agent tmux session
SESSION_NAME="agent"
# Load nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Check if session exists
if tmux has-session -t $SESSION_NAME 2>/dev/null; then
echo "Attaching to existing session: $SESSION_NAME"
tmux attach-session -t $SESSION_NAME
else
echo "Creating new session: $SESSION_NAME"
tmux new-session -s $SESSION_NAME -c /workspace
fi

View File

@@ -0,0 +1,104 @@
#!/bin/bash
# Script all-in-one pentru workflow cu selecție proiect
WORKSPACE="/workspace"
source ~/.nvm/nvm.sh
echo "🚀 Claude Workflow"
echo "=================="
echo ""
# Listează proiectele (directoare cu .git)
echo "📁 Proiecte disponibile:"
echo ""
projects=()
i=1
for dir in "$WORKSPACE"/*/; do
if [ -d "$dir/.git" ]; then
name=$(basename "$dir")
projects+=("$dir")
echo " $i) $name"
((i++))
fi
done
if [ ${#projects[@]} -eq 0 ]; then
echo "❌ Nu am găsit proiecte Git în $WORKSPACE"
exit 1
fi
echo ""
read -p "Alege proiect [1-$((i-1))]: " proj_choice
if [ -z "$proj_choice" ] || [ "$proj_choice" -lt 1 ] || [ "$proj_choice" -gt ${#projects[@]} ]; then
echo "❌ Selecție invalidă"
exit 1
fi
PROJECT_DIR="${projects[$((proj_choice-1))]}"
PROJECT_NAME=$(basename "$PROJECT_DIR")
cd "$PROJECT_DIR" || exit 1
echo ""
echo "📂 Proiect: $PROJECT_NAME"
echo "🌿 Branch curent: $(git branch --show-current)"
echo ""
echo "Ce vrei să faci?"
echo " 1) Începe task nou (branch nou)"
echo " 2) Continuă task existent"
echo " 3) Finalizează task (commit + push)"
echo " 4) Vezi branch-uri"
echo " 5) Pornește Claude pe branch-ul curent"
echo ""
read -p "Alege [1-5]: " choice
case $choice in
1)
read -p "Nume branch (ex: fix/bug-login): " BRANCH_NAME
git checkout main 2>/dev/null || git checkout master
git pull
git checkout -b "$BRANCH_NAME"
echo "✅ Branch creat: $BRANCH_NAME"
echo "Pornesc Claude..."
claude
;;
2)
echo "Branch-uri locale:"
git branch
echo ""
read -p "Nume branch: " BRANCH_NAME
git checkout "$BRANCH_NAME"
echo "Pornesc Claude..."
claude
;;
3)
BRANCH=$(git branch --show-current)
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
echo "❌ Ești pe $BRANCH! Nu face commit direct aici."
exit 1
fi
echo "📋 Status:"
git status --short
echo ""
read -p "Mesaj commit: " COMMIT_MSG
if [ -n "$COMMIT_MSG" ]; then
git add .
git commit -m "$COMMIT_MSG"
git push -u origin "$BRANCH"
echo "✅ Push făcut pe $BRANCH"
fi
;;
4)
echo "Branch curent: $(git branch --show-current)"
echo ""
git branch -a
;;
5)
echo "Pornesc Claude pe $(git branch --show-current)..."
claude
;;
*)
echo "Opțiune invalidă"
;;
esac