This document outlines potential actions that could be added to the remote-machine library to enhance automation capabilities.
-
NodePackageManager Action - NPM/Yarn management
- Install/uninstall npm packages
- Manage package.json dependencies
- List packages
- Run npm scripts
- Install node versions (nvm)
-
RubyPackageManager Action - Ruby gems and Bundler
- Install/uninstall gems
- Manage Gemfile
- RVM environment management
- Run bundler commands
-
Kubernetes Action - kubectl wrapper
- List pods, services, deployments
- Get pod logs
- Exec into pods
- Apply/delete manifests
- Scale deployments
- Check cluster status
-
Terraform Action - Infrastructure as Code
- Plan infrastructure changes
- Apply/destroy resources
- Validate configurations
- Format Terraform code
- Show state
-
CloudCLI Action - AWS/Azure/GCP unified interface
- AWS CLI (S3, EC2, Lambda, etc.)
- Azure CLI (az commands)
- Google Cloud (gcloud)
-
Ansible Action - Configuration management
- Run playbooks
- List inventories
- Run ad-hoc commands
- Validate playbooks
-
Build Action - Make/Maven/Gradle wrapper
- Run builds
- Clean builds
- Run tests
- List targets
- Install artifacts
-
VersionManager Action - nvm/rbenv/pyenv/jenv
- List installed versions
- Switch versions
- Install versions
- Check current version
-
Cargo Action - Rust package manager
- Build/test projects
- Run programs
- Check code
- Generate documentation
-
DatabaseClient Action - PostgreSQL/MySQL/MongoDB
- Execute queries
- Backup/restore databases
- List databases/tables
- Manage users/permissions
- Monitor connections
-
RedisClient Action - Redis operations
- Set/get keys
- List keys
- Monitor performance
- Flush databases
- Manage connections
-
SQLiteAction - SQLite management
- Execute queries
- Backup database
- Analyze schema
- Rsync Action - File synchronization
- Sync directories
- Backup files
- Exclude patterns
- Monitor bandwidth
- Resume transfers
-
HTTP Action - curl/wget/httpie wrapper
- Make HTTP requests
- Download files
- Test endpoints
- Check response codes
- Monitor uptime
-
MonitoringAction - htop/top/systemd monitoring
- Real-time process monitoring
- Memory/CPU metrics
- System resource usage
- Performance profiling
-
OpenSSLAction - SSL/TLS management
- Generate certificates
- Check certificate validity
- Encrypt/decrypt data
- Generate keys
- Manage keystores
-
GPGAction - Encryption and signing
- Encrypt files
- Decrypt files
- Sign/verify files
- List keys
- Import/export keys
-
VaultAction - HashiCorp Vault integration
- Store secrets
- Retrieve secrets
- Manage policies
- Seal/unseal vault
- List secrets
-
CronAction - Job scheduling (Implemented)
- List cron jobs
- Add/remove jobs
- Enable/disable jobs
- View logs
- Test schedule
-
LogManagementAction - Log viewing and analysis
- Tail logs
- Filter logs
- Rotate logs
- Archive logs
- Search logs with patterns
-
UserManagementAction - User and group operations
- Create/delete users
- Manage groups
- Set permissions
- View login history
- Manage sudo access
-
JournalctlAction - systemd journal
- Query logs
- Filter by service/priority
- Follow logs
- Export logs
- Manage journal storage
-
PodmanAction - Podman (Docker alternative)
- Same operations as Docker
- Manage pods
- Rootless containers
-
LXCAction - LXC containers
- List containers
- Start/stop containers
- Execute commands
- Manage networks
-
FFmpegAction - Video/audio processing
- Convert formats
- Extract audio/video
- Get media info
- Transcode files
- Create thumbnails
-
ImageMagickAction - Image processing
- Resize images
- Convert formats
- Add watermarks
- Get image info
- Batch processing
-
JQAction - JSON processing
- Parse JSON
- Filter JSON
- Transform JSON
- Pretty-print JSON
-
ConfigParserAction - INI/YAML/TOML files
- Read configurations
- Write configurations
- Validate syntax
- Merge configs
- Template rendering
-
EnvironmentAction - Environment variable management
- Set/get environment variables
- Load from .env files
- Validate environment
- Export environment
-
ConsulAction - Service discovery
- Register services
- Deregister services
- Query services
- Health checks
- KV store operations
-
EtcdAction - Distributed configuration
- Set/get keys
- Watch keys
- List keys
- Manage leases
- Docker Action
- Git Action
- Archive functions (FSAction)
- Firewall Action (iptables)
- Cron Action
- None currently
- PackageManager (High Priority)
- Kubernetes (High Priority)
- Database Client (High Priority)
- HTTP (High Priority)
- Terraform (Medium Priority)
- Rsync (Medium Priority)
- Docker Compose (Medium Priority)
- Build Action (Medium Priority)
- OpenSSL (Medium Priority)
Tier 1 (High Value - Broad Applicability)
- PackageManager - universal system package management
- Kubernetes - widely used in DevOps
- Database Client - essential for web applications
- HTTP - testing and file downloads
- Archive - (DONE) common administrative task
Tier 2 (Medium Value - Specialized Use Cases) 6. Terraform - infrastructure automation 7. Rsync - backup and sync operations 8. Docker Compose - complement to Docker action 9. Cron - (DONE) scheduled tasks 10. Firewall - (DONE) security operations
Tier 3 (Lower Priority - Niche Use Cases) 11. Cloud CLI - AWS/Azure/GCP specific 12. Build tools - project-specific 13. FFmpeg/ImageMagick - media-specific 14. Vault - secrets management 15. OpenSSL - SSL/TLS operations
All new actions should follow the established patterns:
-
Module Structure
remote_machine/actions/<action_name>.py- Main action classremote_machine/models/<action_name>_types.py- Return type dataclasses- Update
remote_machine/models/__init__.pyto export types - Update
remote_machine/actions/__init__.pyto export action
-
Action Class Pattern
class MyAction: def __init__(self, protocol: SSHProtocol, state: RemoteState): self.protocol = protocol self.state = state def _run(self, cmd: str) -> str: """Run command and raise mapped errors.""" result = self.protocol.exec(cmd, self.state) ErrorMapper.raise_if_error(result) return result.stdout def my_method(self, arg: str) -> ReturnType: """Docstring with clear description.""" output = self._run(f"command {shlex.quote(arg)}") # Parse and return structured data
-
Testing Pattern
- Use
FakeProtocolthat returnsCommandResultobjects - Test both success paths and error conditions
- Mock command outputs with realistic data
- Use
-
Core Integration
- Add action import to
core.py - Add action instantiation in
RemoteMachine.__init__ - Update
capabilities()method
- Add action import to
-
Documentation
- Create comprehensive
.mdfile with examples - Document all methods with parameters and returns
- Provide practical usage examples
- Include error handling examples
- Create comprehensive
- All actions should follow SSH-safe patterns (use
shlex.quote()for arguments) - Return typed dataclasses for structured data
- Use
ErrorMapperfor consistent error handling - Provide comprehensive docstrings and examples
- Include unit tests with
FakeProtocolmocks