From a601b6200c7788f52cedacec7089da370e7a5fd3 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Mon, 9 Feb 2026 07:13:38 +0000 Subject: [PATCH] workspace --- CLAUDE.md | 55 +++++++++++++++---------- autonomous-coding | 1 + claude-plugins | 1 + docs/playwright-mcp.md | 54 +++++++++++++++++++++++++ docs/ttyd.md | 86 ++++++++++++++++++++++++++++++++++++++++ roa2web | 1 + start-agent.sh | 55 ++++++++++++++++++++----- workspace.code-workspace | 8 ++++ 8 files changed, 231 insertions(+), 30 deletions(-) create mode 160000 autonomous-coding create mode 160000 claude-plugins create mode 100644 docs/playwright-mcp.md create mode 100644 docs/ttyd.md create mode 160000 roa2web create mode 100644 workspace.code-workspace diff --git a/CLAUDE.md b/CLAUDE.md index 9e98d70..0a70751 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,39 +1,52 @@ # CLAUDE.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +Ghid pentru Claude Code în acest workspace. ## Mediu -Acesta este un workspace pentru Claude Code pe un LXC container (claude-agent). Proiectele se clonează din Gitea și se lucrează aici. +Container LXC **claude-agent** pentru dezvoltare cu Claude Code. -- **Git remote:** gitea.romfast.ro -- **Proiecte:** /workspace// -- **Logs:** /workspace/.claude-logs/ +| Resursă | Locație | +|---------|---------| +| Git remote | gitea.romfast.ro | +| Proiecte | `/workspace//` | +| Logs | `/workspace/.claude-logs/` | +| Work dir (non-interactiv) | `/workspace/.claude-work/` | -## Reguli pentru Mod Non-Interactiv (claude -p) +## Reguli pentru Mod Non-Interactiv -Când ești lansat cu `claude -p` sau prin `claudep.sh`: +Când ești lansat cu `claude -p` sau `claudep.sh`: -1. **Director de lucru separat** - Creează fișierele în: - ``` - /workspace/.claude-work/_/ - ``` +1. **Director separat** - Creează fișierele în `/workspace/.claude-work/_/` +2. **NU crea fișiere în /workspace** - Doar în directorul de lucru separat +3. **Excepție** - Modificările la fișiere existente se fac în locația originală -2. **NU crea fișiere direct în /workspace** - Toate fișierele temporare, note, output trebuie să fie în directorul de lucru separat. +Structura directorului de lucru: +``` +/workspace/.claude-work// +├── output/ # Rezultate finale +├── temp/ # Fișiere temporare +└── notes.md # Note și concluzii +``` -3. **Structura:** - ``` - /workspace/.claude-work// - ├── output/ # Rezultate finale - ├── temp/ # Fișiere temporare - └── notes.md # Note și concluzii - ``` +## Documentație -4. **Excepție:** Modificările la fișiere existente din proiecte se fac în locația lor originală. +| Subiect | Fișier | +|---------|--------| +| Playwright MCP | [docs/playwright-mcp.md](docs/playwright-mcp.md) | +| ttyd Web Terminal | [docs/ttyd.md](docs/ttyd.md) | -## Comenzi Git +## Quick Reference ```bash +# Git git clone git@gitea.romfast.ro:romfast/.git git push origin main + +# ttyd +sudo systemctl status ttyd +sudo systemctl restart ttyd + +# Playwright +npx playwright install chromium ``` diff --git a/autonomous-coding b/autonomous-coding new file mode 160000 index 0000000..1690a61 --- /dev/null +++ b/autonomous-coding @@ -0,0 +1 @@ +Subproject commit 1690a61a22facfbd2fcbe99eac46d4b459f123b1 diff --git a/claude-plugins b/claude-plugins new file mode 160000 index 0000000..45e28e7 --- /dev/null +++ b/claude-plugins @@ -0,0 +1 @@ +Subproject commit 45e28e7e94a8e10e560bae8750774a8b12fe3470 diff --git a/docs/playwright-mcp.md b/docs/playwright-mcp.md new file mode 100644 index 0000000..28649bc --- /dev/null +++ b/docs/playwright-mcp.md @@ -0,0 +1,54 @@ +# Playwright MCP în LXC Container + +Plugin-ul Playwright MCP permite automatizarea browser-ului în Claude Code. Necesită configurație specială pentru a rula în container LXC unprivileged. + +## Configurație Claude Code + +Adaugă în `~/.claude/settings.json`: + +```json +{ + "mcpServers": { + "playwright": { + "command": "npx", + "args": ["@playwright/mcp@latest", "--headless", "--no-sandbox", "--browser", "chromium"] + } + } +} +``` + +## Configurație LXC (Proxmox) + +În `/etc/pve/lxc/.conf` adaugă: + +``` +lxc.apparmor.profile: unconfined +lxc.cap.drop: +lxc.mount.entry: /dev/shm dev/shm none bind,optional,create=dir 0 0 +``` + +**Important:** După modificare, restartează containerul: +```bash +pct stop && pct start +``` + +## Instalare Chromium + +```bash +npx playwright install chromium +``` + +## Verificare + +Pentru a testa că Playwright funcționează: +```bash +npx playwright open --headless about:blank +``` + +## Troubleshooting + +### Eroare: "No usable sandbox" +Asigură-te că `--no-sandbox` este în args și configurația LXC este aplicată. + +### Eroare: "Browser not found" +Rulează `npx playwright install chromium` pentru a instala browser-ul. diff --git a/docs/ttyd.md b/docs/ttyd.md new file mode 100644 index 0000000..2df5fa4 --- /dev/null +++ b/docs/ttyd.md @@ -0,0 +1,86 @@ +# ttyd - Web Terminal + +ttyd permite accesul la terminalul tmux prin browser web. + +## Instalare + +```bash +sudo apt install ttyd +``` + +## Configurație serviciu systemd + +Creează `/etc/systemd/system/ttyd.service`: + +```ini +[Unit] +Description=ttyd - Web Terminal for Claude Agent +After=network.target + +[Service] +Type=simple +User=claude +Group=claude +WorkingDirectory=/workspace +Environment="HOME=/home/claude" +Environment="NVM_DIR=/home/claude/.nvm" +Environment="PATH=/home/claude/.nvm/versions/node/v22.16.0/bin:/usr/local/bin:/usr/bin:/bin" +ExecStart=/usr/bin/ttyd -p 7681 -c claude:claude2025 -W /workspace/start-agent.sh +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target +``` + +## Activare serviciu + +```bash +sudo systemctl daemon-reload +sudo systemctl enable --now ttyd +``` + +## Acces + +- **URL:** `http://:7681` +- **Credențiale:** claude / claude2025 + +## Comenzi utile + +```bash +# Status serviciu +sudo systemctl status ttyd + +# Restart serviciu +sudo systemctl restart ttyd + +# Logs în timp real +sudo journalctl -u ttyd -f + +# Oprire serviciu +sudo systemctl stop ttyd +``` + +## Opțiuni ttyd + +| Flag | Descriere | +|------|-----------| +| `-p PORT` | Portul web (default: 7681) | +| `-c user:pass` | Autentificare basic | +| `-W` | Permite write (client poate tasta) | +| `-t fontSize=N` | Dimensiune font | +| `-i INTERFACE` | Interfața de ascultare | + +## Troubleshooting + +### Serviciul nu pornește +Verifică logs: `sudo journalctl -u ttyd -e` + +### Eroare autentificare +Verifică că user/parola sunt corecte în ExecStart. + +### tmux session nu se creează +Verifică că `/workspace/start-agent.sh` este executabil: +```bash +chmod +x /workspace/start-agent.sh +``` diff --git a/roa2web b/roa2web new file mode 160000 index 0000000..1366dbc --- /dev/null +++ b/roa2web @@ -0,0 +1 @@ +Subproject commit 1366dbc11c796a68021b875b9e2c8c6c738ab2d5 diff --git a/start-agent.sh b/start-agent.sh index 4854253..e1bf28a 100755 --- a/start-agent.sh +++ b/start-agent.sh @@ -1,17 +1,54 @@ -#!/bin/bash -# Start or attach to Claude agent tmux session +#!/usr/bin/env bash +# Start or attach to tmux agent session (Claude on-demand) SESSION_NAME="agent" +WORKDIR="/workspace" -# Load nvm +# ---- NVM bootstrap (available, not forced) ---- 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 +NVM_LOAD=' +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" +' + +# ---- Attach if 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 + tmux attach-session -t "$SESSION_NAME" + exit 0 fi + +echo "Creating new session: $SESSION_NAME" + +# ---- Create session ---- +tmux new-session -d -s "$SESSION_NAME" -c "$WORKDIR" + +# Pane 0: Main shell (editor / ssh / control) +tmux send-keys -t "$SESSION_NAME:0.0" "cd $WORKDIR && clear" C-m +tmux send-keys -t "$SESSION_NAME:0.0" "$NVM_LOAD" C-m + +# Pane 1: Right (AI / ssh / tools) +tmux split-window -h -t "$SESSION_NAME:0" -c "$WORKDIR" +tmux send-keys -t "$SESSION_NAME:0.1" "$NVM_LOAD" C-m +tmux send-keys -t "$SESSION_NAME:0.1" "echo 'AI / tools pane (run claude manually)'" C-m + +# Pane 2: Bottom-left (review / second shell) +tmux select-pane -t "$SESSION_NAME:0.0" +tmux split-window -v -c "$WORKDIR" +tmux send-keys -t "$SESSION_NAME:0.2" "$NVM_LOAD" C-m +tmux send-keys -t "$SESSION_NAME:0.2" "echo 'Review / ssh pane'" C-m + +# Pane 3: Bottom (tests / logs) +tmux select-pane -t "$SESSION_NAME:0.0" +tmux split-window -v -c "$WORKDIR" +tmux send-keys -t "$SESSION_NAME:0.3" "$NVM_LOAD" C-m +tmux send-keys -t "$SESSION_NAME:0.3" "echo 'Tests / logs pane'" C-m + +# ---- Layout & focus ---- +tmux select-layout -t "$SESSION_NAME" tiled +tmux select-pane -t "$SESSION_NAME:0.0" + +# ---- Attach ---- +tmux attach-session -t "$SESSION_NAME" diff --git a/workspace.code-workspace b/workspace.code-workspace new file mode 100644 index 0000000..876a149 --- /dev/null +++ b/workspace.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": {} +} \ No newline at end of file