refactor: finish the AgentHub rename and drop the MCP server
Two leftovers from the rebrand, done together because they touch the same docs and manifests. **Data directory.** `agent-dashboard` could not simply be renamed in the source: it names a real directory holding the live SQLite database. Startup now moves it once, via `migrateLegacyDataDir()` in `server/lib/claude-home.js` — a same-filesystem rename, so it is instant even at multiple gigabytes and cannot leave two divergent copies. `getDataDir()` stays PURE and resolves to the legacy path until the move happens; the first version of this put the rename inside the getter, which meant `npm run test:server` relocated the developer's real database as a side effect. The call sits behind `require.main === module` and ahead of the router requires, because those pull in db.js, which opens SQLite at module load. A failed rename is silent and the old directory keeps being used: an unfashionable directory name beats a blank database beside an unreachable one. Same treatment for the port-discovery file (`.agent-dashboard.json` → `.agenthub.json`, old one dropped on write). Not renamed on purpose: the Sagi localStorage keys (renaming silently resets everyone's prefs) and the PWA manifest `id` (changing it orphans an installed app). **MCP server.** 4 tool calls in 46 days across 577,132 events, against 4,556 lines of TypeScript, a 2 MB committed build artifact, and a pre-commit guard that had already blocked commits twice. Deleted: `mcp/`, the maintainer skills and `mcp-reviewer` agent, the build check, `plugins/agenthub/.mcp.json`, `docs/MCP.md`, 12 npm scripts, 5 Makefile targets, and every doc section describing it. Kept, because they are unrelated things sharing the name: the Config Explorer's MCP tab and its API, per-lane Playwright MCP, the agenthub-config plugin's MCP audit, and the historical `mcp__plugin_agenthub_*` events that analytics must keep attributing. Verified: server 1432/1432, client 459/459, tsc clean, prettier clean. Both directions of the migration proven — a sandbox-HOME test run leaves the legacy directory untouched, and a real boot moves it with its contents intact.
This commit is contained in:
+43
-44
@@ -149,8 +149,8 @@ graph TB
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://github.com/your-org/agent-dashboard.git
|
||||
cd agent-dashboard
|
||||
git clone https://github.com/your-org/agenthub.git
|
||||
cd agenthub
|
||||
|
||||
# Install dependencies
|
||||
npm run setup
|
||||
@@ -190,7 +190,6 @@ npm run dev:server
|
||||
npm run dev:client
|
||||
|
||||
# Terminal 3: MCP server (optional)
|
||||
npm run mcp:dev
|
||||
```
|
||||
|
||||
---
|
||||
@@ -225,10 +224,10 @@ npm run build
|
||||
# 3. Set environment variables
|
||||
export NODE_ENV=production
|
||||
export PORT=4820
|
||||
export DASHBOARD_DB_PATH=/var/lib/agent-dashboard/dashboard.db
|
||||
export DASHBOARD_DB_PATH=/var/lib/agenthub/dashboard.db
|
||||
|
||||
# 4. Create data directory
|
||||
mkdir -p /var/lib/agent-dashboard
|
||||
mkdir -p /var/lib/agenthub
|
||||
|
||||
# 5. Start server
|
||||
node server/index.js
|
||||
@@ -250,7 +249,7 @@ DASHBOARD_TOKEN= # required on /api/* + WS when set; use
|
||||
DASHBOARD_ALLOWED_HOSTS= # extra Host names (comma-sep) for a LAN bind
|
||||
|
||||
# Database
|
||||
DASHBOARD_DB_PATH=/var/lib/agent-dashboard/dashboard.db
|
||||
DASHBOARD_DB_PATH=/var/lib/agenthub/dashboard.db
|
||||
|
||||
# Ingestion polls (0 disables either one)
|
||||
DASHBOARD_WORKFLOW_POLL_MS=12000 # Workflow-tool run journals
|
||||
@@ -278,7 +277,7 @@ LOG_LEVEL=info # debug | info | warn | error
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
agent-dashboard:
|
||||
agenthub:
|
||||
build: .
|
||||
ports:
|
||||
- "4820:4820"
|
||||
@@ -382,7 +381,7 @@ graph TB
|
||||
pip install awsebcli
|
||||
|
||||
# Initialize
|
||||
eb init -p node.js agent-dashboard
|
||||
eb init -p node.js agenthub
|
||||
|
||||
# Create environment
|
||||
eb create production
|
||||
@@ -401,20 +400,20 @@ eb open
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: agent-dashboard
|
||||
name: agenthub
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: agent-dashboard
|
||||
app: agenthub
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: agent-dashboard
|
||||
app: agenthub
|
||||
spec:
|
||||
containers:
|
||||
- name: agent-dashboard
|
||||
image: agent-dashboard:latest
|
||||
- name: agenthub
|
||||
image: agenthub:latest
|
||||
ports:
|
||||
- containerPort: 4820
|
||||
env:
|
||||
@@ -426,16 +425,16 @@ spec:
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: agent-dashboard-pvc
|
||||
claimName: agenthub-pvc
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: agent-dashboard
|
||||
name: agenthub
|
||||
spec:
|
||||
selector:
|
||||
app: agent-dashboard
|
||||
app: agenthub
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
@@ -453,9 +452,9 @@ graph TB
|
||||
end
|
||||
|
||||
subgraph "Pods"
|
||||
Pod1[agent-dashboard-1<br/>:4820]
|
||||
Pod2[agent-dashboard-2<br/>:4820]
|
||||
Pod3[agent-dashboard-3<br/>:4820]
|
||||
Pod1[agenthub-1<br/>:4820]
|
||||
Pod2[agenthub-2<br/>:4820]
|
||||
Pod3[agenthub-3<br/>:4820]
|
||||
end
|
||||
|
||||
subgraph "Storage"
|
||||
@@ -488,22 +487,22 @@ graph TB
|
||||
npm install -g pm2
|
||||
|
||||
# Start application
|
||||
pm2 start server/index.js --name agent-dashboard
|
||||
pm2 start server/index.js --name agenthub
|
||||
|
||||
# Start with environment
|
||||
pm2 start server/index.js --name agent-dashboard --env production
|
||||
pm2 start server/index.js --name agenthub --env production
|
||||
|
||||
# View logs
|
||||
pm2 logs agent-dashboard
|
||||
pm2 logs agenthub
|
||||
|
||||
# Monitor
|
||||
pm2 monit
|
||||
|
||||
# Restart
|
||||
pm2 restart agent-dashboard
|
||||
pm2 restart agenthub
|
||||
|
||||
# Stop
|
||||
pm2 stop agent-dashboard
|
||||
pm2 stop agenthub
|
||||
|
||||
# Auto-start on system boot
|
||||
pm2 startup
|
||||
@@ -516,7 +515,7 @@ pm2 save
|
||||
// ecosystem.config.js
|
||||
module.exports = {
|
||||
apps: [{
|
||||
name: 'agent-dashboard',
|
||||
name: 'agenthub',
|
||||
script: './server/index.js',
|
||||
instances: 2,
|
||||
exec_mode: 'cluster',
|
||||
@@ -527,11 +526,11 @@ module.exports = {
|
||||
env_production: {
|
||||
NODE_ENV: 'production',
|
||||
PORT: 4820,
|
||||
DASHBOARD_DB_PATH: '/var/lib/agent-dashboard/dashboard.db'
|
||||
DASHBOARD_DB_PATH: '/var/lib/agenthub/dashboard.db'
|
||||
},
|
||||
max_memory_restart: '500M',
|
||||
error_file: '/var/log/agent-dashboard/error.log',
|
||||
out_file: '/var/log/agent-dashboard/out.log',
|
||||
error_file: '/var/log/agenthub/error.log',
|
||||
out_file: '/var/log/agenthub/out.log',
|
||||
time: true
|
||||
}]
|
||||
};
|
||||
@@ -545,18 +544,18 @@ pm2 start ecosystem.config.js --env production
|
||||
### Systemd Service (Linux)
|
||||
|
||||
```ini
|
||||
# /etc/systemd/system/agent-dashboard.service
|
||||
# /etc/systemd/system/agenthub.service
|
||||
[Unit]
|
||||
Description=Agent Dashboard
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=agent-dashboard
|
||||
WorkingDirectory=/opt/agent-dashboard
|
||||
User=agenthub
|
||||
WorkingDirectory=/opt/agenthub
|
||||
Environment=NODE_ENV=production
|
||||
Environment=PORT=4820
|
||||
Environment=DASHBOARD_DB_PATH=/var/lib/agent-dashboard/dashboard.db
|
||||
Environment=DASHBOARD_DB_PATH=/var/lib/agenthub/dashboard.db
|
||||
ExecStart=/usr/bin/node server/index.js
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
@@ -569,14 +568,14 @@ WantedBy=multi-user.target
|
||||
|
||||
```bash
|
||||
# Enable and start service
|
||||
sudo systemctl enable agent-dashboard
|
||||
sudo systemctl start agent-dashboard
|
||||
sudo systemctl enable agenthub
|
||||
sudo systemctl start agenthub
|
||||
|
||||
# Check status
|
||||
sudo systemctl status agent-dashboard
|
||||
sudo systemctl status agenthub
|
||||
|
||||
# View logs
|
||||
sudo journalctl -u agent-dashboard -f
|
||||
sudo journalctl -u agenthub -f
|
||||
```
|
||||
|
||||
---
|
||||
@@ -680,8 +679,8 @@ graph TB
|
||||
#!/bin/bash
|
||||
# scripts/backup.sh
|
||||
|
||||
BACKUP_DIR="/var/backups/agent-dashboard"
|
||||
DB_PATH="/var/lib/agent-dashboard/dashboard.db"
|
||||
BACKUP_DIR="/var/backups/agenthub"
|
||||
DB_PATH="/var/lib/agenthub/dashboard.db"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
BACKUP_FILE="$BACKUP_DIR/dashboard_$TIMESTAMP.db"
|
||||
|
||||
@@ -695,7 +694,7 @@ sqlite3 "$DB_PATH" "VACUUM INTO '$BACKUP_FILE'"
|
||||
gzip "$BACKUP_FILE"
|
||||
|
||||
# Upload to S3 (optional)
|
||||
aws s3 cp "$BACKUP_FILE.gz" s3://my-backups/agent-dashboard/
|
||||
aws s3 cp "$BACKUP_FILE.gz" s3://my-backups/agenthub/
|
||||
|
||||
# Delete old backups (keep last 7 days)
|
||||
find "$BACKUP_DIR" -name "dashboard_*.db.gz" -mtime +7 -delete
|
||||
@@ -710,7 +709,7 @@ echo "Backup completed: $BACKUP_FILE.gz"
|
||||
# scripts/restore.sh
|
||||
|
||||
BACKUP_FILE=$1
|
||||
DB_PATH="/var/lib/agent-dashboard/dashboard.db"
|
||||
DB_PATH="/var/lib/agenthub/dashboard.db"
|
||||
|
||||
if [ -z "$BACKUP_FILE" ]; then
|
||||
echo "Usage: ./restore.sh <backup_file.db.gz>"
|
||||
@@ -718,17 +717,17 @@ if [ -z "$BACKUP_FILE" ]; then
|
||||
fi
|
||||
|
||||
# Stop application
|
||||
systemctl stop agent-dashboard
|
||||
systemctl stop agenthub
|
||||
|
||||
# Decompress backup
|
||||
gunzip -c "$BACKUP_FILE" > /tmp/restore.db
|
||||
|
||||
# Restore database
|
||||
cp /tmp/restore.db "$DB_PATH"
|
||||
chown agent-dashboard:agent-dashboard "$DB_PATH"
|
||||
chown agenthub:agenthub "$DB_PATH"
|
||||
|
||||
# Start application
|
||||
systemctl start agent-dashboard
|
||||
systemctl start agenthub
|
||||
|
||||
echo "Restore completed from $BACKUP_FILE"
|
||||
```
|
||||
@@ -767,7 +766,7 @@ graph TB
|
||||
### TLS Configuration (Nginx Reverse Proxy)
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/sites-available/agent-dashboard
|
||||
# /etc/nginx/sites-available/agenthub
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name dashboard.example.com;
|
||||
|
||||
Reference in New Issue
Block a user