# rdev v0.3.0 - Git Integration

**Date**: 2026-01-24
**Status**: Ready for deployment

## Summary

Full git integration - claudebox pods can now commit and push changes back to GitHub. The container image includes git config for the rdev-bot identity, and SSH keys are mounted for authenticated operations.

## What Was Built

### Updated Dockerfile

Added to the claudebox image:
- `openssh-client` package for SSH operations
- Git global config for rdev-bot identity
- Pre-created `/root/.ssh` directory with correct permissions
- `push.autoSetupRemote` for easier branch pushing

```dockerfile
# Configure git for rdev-bot identity
RUN git config --global user.name "rdev-bot" \
    && git config --global user.email "rdev@orchard9.ai" \
    && git config --global init.defaultBranch main \
    && git config --global push.autoSetupRemote true

# Create SSH directory with correct permissions
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
```

### Image Version Bump

All StatefulSets updated to use `v0.3.0`:
- `claudebox.yaml`
- `claudebox-pantheon.yaml`
- `claudebox-aeries.yaml`

## Changes from v0.2

| Component | v0.2 | v0.3 |
|-----------|------|------|
| Image | v0.1.0 | v0.3.0 |
| Git config | None | rdev-bot identity |
| SSH client | Not installed | Installed |
| Push capability | Clone only | Full read/write |

## Git Identity

All commits from rdev claudeboxes will be attributed to:
- **Name**: rdev-bot
- **Email**: rdev@orchard9.ai

Example commit:
```
commit abc123...
Author: rdev-bot <rdev@orchard9.ai>
Date:   Fri Jan 24 2026

    Fix authentication bug in handler

    Co-Authored-By: Claude <noreply@anthropic.com>
```

## Deployment Instructions

### 1. Build and Push New Image

```bash
cd /path/to/rdev

# Build and push v0.3.0
./scripts/build-push.sh v0.3.0
```

### 2. Complete v0.2 Setup (if not done)

Ensure deploy keys are configured:
```bash
# Generate keys
./scripts/generate-deploy-key.sh pantheon
./scripts/generate-deploy-key.sh aeries

# Add public keys to GitHub (with write access!)
# Update secrets.yaml with base64-encoded private keys
```

### 3. Deploy

```bash
export KUBECONFIG=~/.kube/orchard9-k3sf.yaml
kubectl apply -k deployments/k8s/base

# Restart pods to pick up new image
kubectl rollout restart statefulset -n rdev claudebox
kubectl rollout restart statefulset -n rdev claudebox-pantheon
kubectl rollout restart statefulset -n rdev claudebox-aeries
```

### 4. Verify Git Push

```bash
# Test push capability
kubectl exec -n rdev claudebox-pantheon-0 -- bash -c "
  cd /workspace
  git checkout -b rdev-test-push
  echo '# Test from rdev' >> README.md
  git add README.md
  git commit -m 'test: verify rdev push capability'
  git push origin rdev-test-push
"

# Clean up test branch
kubectl exec -n rdev claudebox-pantheon-0 -- bash -c "
  cd /workspace
  git checkout main
  git branch -D rdev-test-push
"
# Also delete the remote branch via GitHub UI or gh cli
```

## Verification Checklist

```bash
# 1. Check git config in container
kubectl exec -n rdev claudebox-pantheon-0 -- git config --global --list
# Should show:
# user.name=rdev-bot
# user.email=rdev@orchard9.ai
# init.defaultbranch=main
# push.autosetupremote=true

# 2. Verify SSH access to GitHub
kubectl exec -n rdev claudebox-pantheon-0 -- ssh -T git@github.com
# Should show: Hi orchard9/pantheon! You've successfully authenticated...

# 3. Test fetch
kubectl exec -n rdev claudebox-pantheon-0 -- bash -c "cd /workspace && git fetch origin"

# 4. Test commit (local)
kubectl exec -n rdev claudebox-pantheon-0 -- bash -c "
  cd /workspace
  echo 'test' >> /tmp/test.txt
  git add /tmp/test.txt 2>/dev/null || echo 'File outside repo - expected'
"

# 5. Test push (creates branch, then clean up)
# See verification section above
```

## What's Next (v0.4)

Go API server for controlling claudebox pods:
- REST endpoints for claude, shell, git commands
- SSE streaming for output
- Kubernetes RBAC for pod exec
- Project registry

## Files Modified

```
Dockerfile                              # Added git config, openssh-client
deployments/k8s/base/claudebox.yaml     # Image v0.1.0 → v0.3.0
deployments/k8s/base/claudebox-pantheon.yaml  # Image v0.1.0 → v0.3.0
deployments/k8s/base/claudebox-aeries.yaml    # Image v0.1.0 → v0.3.0
```

## Troubleshooting

### Push fails with "Permission denied"
- Ensure deploy key has "Allow write access" checked in GitHub
- Verify SSH key is correctly mounted: `ls -la /root/.ssh/`
- Test SSH: `ssh -vT git@github.com`

### Commits show wrong author
- Check git config: `git config --global --list`
- Image might be old: verify `v0.3.0` is running

### "Host key verification failed"
- Ensure known_hosts is mounted correctly
- Check secret contains github.com host keys
