Skip to content

Pr eternalhist #13198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

jeffrey-l-turner
Copy link

Add EternalHist Plugin - Advanced Persistent Command History with Multi-Remote Sync

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.
  • If the code introduces new aliases, I provide a valid use case for all plugin users down below.

Changes:

New Plugin: EternalHist

  • Location: plugins/eternalhist/
  • Files Added:
    • eternalhist.plugin.zsh - Main plugin implementation
    • README.md - Comprehensive documentation

Core Features

  • Persistent command history across shell sessions and system reboots
  • Multi-remote synchronization support for cloud storage (Dropbox, Google Drive, S3, SSH servers)
  • Advanced search capabilities with regex support and multi-term filtering
  • Default search behavior - eternalhist <terms> searches without requiring explicit search command
  • Escape mechanism - Use \command to search for command names that conflict with plugin commands
  • Backward compatibility - Provides ht() function for existing workflows

Commands Provided

  • eternalhist [search_terms...] - Search eternal history (default behavior)
  • eternalhist add [command] - Add command to eternal history
  • eternalhist show [limit] - Display recent eternal history
  • eternalhist stats - Show usage statistics
  • eternalhist sync [remote...] - Synchronize with configured remotes
  • eternalhist remotes list/test - Manage remote configurations
  • eternalhist config - Show current configuration
  • eternalhist clear - Clear all eternal history (with confirmation)
  • ht [search_terms...] - Backward compatibility alias

Environment Variable Configuration

  • Multi-remote support: ETERNALHIST_REMOTES="primary,backup"
  • Per-remote settings: ETERNALHIST_<REMOTE>_PROVIDER, ETERNALHIST_<REMOTE>_PATH, etc.
  • Sync strategies: Configurable sync behavior, timeouts, and conflict resolution
  • Security options: Encryption support and privacy filters

Provider Support

  • SSH/SCP: Full implementation for remote server sync
  • Cloud providers: Framework ready for Dropbox, Google Drive, S3 (placeholder implementations)
  • Extensible design: Easy to add new storage providers

Use Cases:

For Individual Users

  • Cross-session history: Never lose important commands between terminal sessions
  • Multi-device sync: Keep command history synchronized across laptops, servers, and workstations
  • Advanced search: Find complex commands from weeks or months ago using flexible search patterns
  • Backup and recovery: Automatic backup of command history to prevent data loss

For Teams and Organizations

  • Shared knowledge base: Team members can sync and share useful command patterns
  • DevOps workflows: Maintain persistent history of deployment and maintenance commands
  • Audit trails: Keep comprehensive logs of executed commands with timestamps and directories
  • Remote work: Synchronize command history between home and office environments

Specific Examples

# Find that complex docker command from last month
eternalhist docker run --mount

# Search for git commands with specific patterns
eternalhist git rebase interactive

# Sync command history to backup server
eternalhist sync backup

# Search for commands that conflict with plugin names
eternalhist \add user database  # Search for "add user" commands

# Get statistics on command usage
eternalhist stats

Other comments:

Design Philosophy

This plugin extends the concept of shell history beyond the limitations of built-in history mechanisms. While standard shell history is often limited by size, session boundaries, and single-machine scope, EternalHist provides unlimited, persistent, and distributed command history management.

Compatibility

  • Zero breaking changes to existing oh-my-zsh functionality
  • Optional activation - Only active when explicitly added to plugins list
  • Graceful degradation - Works locally even without remote configuration
  • Secure by default - All remote operations require explicit configuration

Performance Considerations

  • Lazy loading - Remote sync operations are asynchronous and don't block shell startup
  • Configurable limits - Search result limits prevent overwhelming output
  • Efficient search - Uses standard Unix tools (grep, tail) for fast local searches
  • Optional features - Auto-sync and auto-add can be disabled for minimal overhead

Future Extensibility

The plugin architecture supports easy addition of:

  • New cloud storage providers
  • Enhanced search algorithms (fuzzy matching, semantic search)
  • Integration with external tools (fzf, ripgrep)
  • Export formats for analysis and reporting
  • Collaborative features for team environments

Security Notes

  • Local file permissions set to 600 (user-only access)
  • Configurable privacy filters to exclude sensitive commands
  • Encryption support framework for sensitive environments
  • No automatic data collection - all sync operations are explicit and user-controlled

@ohmyzsh ohmyzsh bot added Area: plugin Issue or PR related to a plugin Type: documentation Documentation issue or Pull Request New: plugin Request for a plugin or Pull Request that adds one labels Jul 2, 2025
@ohmyzsh ohmyzsh bot added this to Main project Jul 2, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Main project Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: plugin Issue or PR related to a plugin New: plugin Request for a plugin or Pull Request that adds one Type: documentation Documentation issue or Pull Request
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

1 participant