hosts-go/memory-bank/productContext.md
phg d66ec51ebd feat: Initialize hosts-go project with foundational structure and core functionality
- Created activeContext.md and productContext.md to outline project goals and current focus.
- Established progress.md to track project milestones and tasks.
- Developed projectbrief.md detailing application overview, requirements, and directory structure.
- Documented systemPatterns.md to describe architecture and design patterns used.
- Compiled techContext.md to specify technologies and development setup.
- Implemented comprehensive unit tests in models_test.go for HostEntry and HostsFile functionalities.
2025-08-12 22:41:33 +02:00

62 lines
2.8 KiB
Markdown

# Product Context: hosts-go
## Why This Project Exists
The `/etc/hosts` file is a critical system file that maps hostnames to IP addresses, but managing it manually is cumbersome and error-prone. Users currently face several pain points:
- **Manual editing**: Requires opening `/etc/hosts` in a text editor with sudo privileges
- **Format preservation**: Easy to accidentally break formatting or lose comments
- **Entry management**: No easy way to temporarily disable entries without deleting them
- **DNS resolution**: Manual IP address updates when hostnames change
- **Organization**: No built-in sorting or reordering capabilities
## Problems It Solves
1. **Safe editing**: Provides a structured interface that validates changes before writing
2. **Entry activation**: Toggle entries on/off without losing the configuration
3. **Organization**: Sort and reorder entries intuitively
4. **DNS integration**: Automatically resolve hostnames to current IP addresses
5. **Comment preservation**: Maintain documentation alongside entries
6. **Permission handling**: Only request sudo access when actually editing
## How It Should Work
### Core User Experience
- **View mode by default**: Browse entries safely without modification risk
- **Explicit edit mode**: Clear transition to editing with permission request
- **Two-pane interface**: List view + detail view for efficient navigation
- **Keyboard-driven**: Fast navigation and actions via keyboard shortcuts
- **Visual feedback**: Clear indicators for active/inactive entries and changes
### Key Workflows
1. **Browse entries**: Launch app, see all current hosts entries with status
2. **Quick activation**: Toggle entries on/off with simple keypress
3. **Edit existing**: Select entry, enter edit mode, modify details
4. **Add new**: Create new hostname mappings with validation
5. **DNS resolution**: Update IP addresses automatically from DNS
6. **Reorder entries**: Drag/move entries to organize logically
## User Experience Goals
### Immediate Value
- **Zero learning curve**: Intuitive interface familiar to CLI users
- **Safety first**: Hard to accidentally break the hosts file
- **Speed**: Faster than manual editing for common tasks
### Long-term Benefits
- **Organized hosts**: Keep entries structured and documented
- **Confidence**: Know changes are validated before applied
- **Efficiency**: Common tasks become single keystrokes
### Target Users
- **Developers**: Managing local development environments
- **System administrators**: Bulk hosts file management
- **Network engineers**: Testing connectivity and DNS overrides
- **Security professionals**: Blocking/redirecting malicious domains
## Success Metrics
- Users prefer this tool over manual `/etc/hosts` editing
- Reduces hosts file corruption incidents
- Speeds up common host management tasks
- Provides confidence in making changes