This repository has been archived on 2026-06-13. You can view files and clone it, but cannot push or open issues or pull requests.
anvillm/services/runit
Levi Neely b7a823f120 feat: split monolith into anvilsrv daemon and Assist client
Major architectural refactoring to separate server and UI concerns:

Architecture Changes:
- Split into anvilsrv (server daemon) and Assist (Acme client)
- Removed UI coupling from server (OnAliasChange, WinID tracking)
- Server runs as background daemon, client reconnects as needed
- Client auto-starts server if not running

Server (anvilsrv):
- Add daemon management: start/stop/status commands
- Daemonize by default (fgstart for foreground/debug mode)
- Proper PID file handling in $NAMESPACE (not /tmp)
- Graceful shutdown with SIGTERM handling
- Duplicate start prevention with stale PID detection

Client (Assist):
- Auto-start anvilsrv if not running
- Fixed plan9 package imports (OWRITE/OREAD constants)
- Removed unused context import

Security Fixes:
- Move PID file from /tmp to $NAMESPACE (prevent symlink attacks)
- Add path validation in session creation:
  - Clean path traversal (/../../../etc → /etc)
  - Verify directory exists before creating session
  - Ensure absolute paths
  - Reject non-directory paths
- Add SECURITY.md documenting 9P socket risks

Service Integration:
- Add systemd service files (system, user, template)
- Add runit service files (run, finish)
- Add service documentation and installation instructions

Build & Testing:
- Both binaries build successfully
- All daemon operations verified (start/stop/status/daemonize)
- Path validation tested and working
- Auto-start functionality verified
- Add DevReviewQA workflow script

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 11:30:57 +01:00
..
README.md feat: split monolith into anvilsrv daemon and Assist client 2026-02-14 11:30:57 +01:00
finish feat: split monolith into anvilsrv daemon and Assist client 2026-02-14 11:30:57 +01:00
run feat: split monolith into anvilsrv daemon and Assist client 2026-02-14 11:30:57 +01:00

README.md

runit Service for anvilsrv

This directory contains a runit service definition for anvilsrv.

Installation

  1. Copy this directory to /etc/sv/anvilsrv:

    sudo cp -r services/runit /etc/sv/anvilsrv
    sudo chmod +x /etc/sv/anvilsrv/run
    sudo chmod +x /etc/sv/anvilsrv/finish
    
  2. Enable the service by creating a symlink:

    sudo ln -s /etc/sv/anvilsrv /var/service/anvilsrv
    
  3. The service will start automatically. Check status:

    sudo sv status anvilsrv
    

Service Management

  • Start: sudo sv start anvilsrv
  • Stop: sudo sv stop anvilsrv
  • Restart: sudo sv restart anvilsrv
  • Status: sudo sv status anvilsrv
  • View logs: sudo svlogd /var/log/anvilsrv

Notes

  • The service runs as the current user specified in the run script
  • Logs are written to stderr and can be captured using svlogd
  • The service will automatically restart if it crashes
  • To disable the service, remove the symlink from /var/service:
    sudo rm /var/service/anvilsrv