Skip to content

[Feature Idea] Command History #36

Description

@albertalef

Problem: No way to review or replay previously executed commands.

Solution: Track command execution history with query interface.

sh do
  ls("-la")
  pwd
  cat("file.txt")
end

# Query history
RubyShell.history.last           # Most recent command
RubyShell.history.last(5)        # Last 5 commands
RubyShell.history.all            # All commands in session

# History entry details
entry = RubyShell.history.last
entry.command     # "cat file.txt"
entry.stdout      # "file contents..."
entry.stderr      # ""
entry.exit_code   # 0
entry.duration    # 0.005
entry.timestamp   # 2024-01-15 10:30:45
entry.success?    # true

# Search history
RubyShell.history.find_by(command: /git/)
RubyShell.history.find_by(exit_code: 1)
RubyShell.history.successful
RubyShell.history.failed

# Replay command
RubyShell.history.last.replay

# Persist to file
RubyShell.history.save("commands.log")
RubyShell.history.load("commands.log")

# Clear history
RubyShell.history.clear

Activity

  1. Repository owner locked and limited conversation to collaborators on Feb 5, 2026
  2. converted this issue into a discussion #55 on Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions