Skip to main content

๐Ÿ• Your loyal companion for tracking shell commands - silent, smart, and adorable!

Project description

๐Ÿ• Shelldog - Your Faithful Command Companion

License: MIT Python 3.7+ Code style: black

Your loyal companion for tracking shell commands - because every good developer needs a faithful friend who remembers everything!

    /\_/\  
   ( o.o ) 
    > ^ <   "Woof! I'm watching... silently."

Shelldog is a silent, intelligent command tracker for your terminal. Think of it as your development diary that writes itself - tracking every command you run, so you never have to remember "what did I do yesterday?" ever again!

๐ŸŽฏ Why Shelldog?

Ever found yourself thinking:

  • "What was that curl command I ran last week?"
  • "How did I set up this environment again?"
  • "I need to write documentation... if only I could remember what I did!"
  • "What commands did I run before that bug appeared?"

Shelldog sits quietly in the background and remembers EVERYTHING for you! ๐Ÿง 

โœจ Features

  • ๐Ÿคซ Silent Tracking - Works invisibly without cluttering your terminal
  • ๐Ÿ”’ Privacy First - Automatically masks passwords, tokens, and API keys
  • ๐ŸŽฏ Smart Detection - Knows when you're in a virtual environment
  • ๐Ÿ“ Project-Level Logs - Each venv gets its own history file at the project root
  • ๐ŸŽญ Personality - Because who says CLI tools have to be boring?
  • ๐Ÿš€ Zero Performance Impact - Logs asynchronously in the background
  • ๐ŸŒˆ Both Bash & Zsh - Works with your favorite shell

๐Ÿ“ฆ Installation

Quick Install

pip install shelldog

From Source

git clone https://github.com/Ansumanbhujabal/shelldog.git
cd shelldog
pip install -e .

๐Ÿš€ Quick Start

1. Start Tracking

# Wake up the dog!
shelldog follow

# Activate tracking in your current shell
eval "$(shelldog follow -q)"

That's it! Shelldog is now silently logging all your commands. ๐ŸŽ‰

2. View Your History

# See everything
shelldog log

# Just today's commands
shelldog log --today

# Last 20 commands
shelldog log -n 20

3. Check Status

shelldog status

๐ŸŽฎ Commands

Core Commands

Command Description
shelldog follow Start tracking commands (activates the good boy!)
shelldog stop Stop tracking (sends doggo to sleep)
shelldog log View command history
shelldog status Check if Shelldog is watching
shelldog clear Clear command history
shelldog stats See cool statistics about your commands

Fun Commands (Because Why Not?)

Command Description
shelldog bark Make Shelldog bark! ๐Ÿ•
shelldog treat Give Shelldog a treat! ๐Ÿฆด
shelldog goodboy Tell Shelldog he's a good boy! ๐Ÿ†

๐Ÿ”ง How It Works

The Magic Behind the Scenes

  1. Shell Hook: Shelldog installs a tiny hook in your shell (via DEBUG trap in Bash or preexec in Zsh)
  2. Silent Logger: Every command gets logged asynchronously - zero impact on your workflow
  3. Smart Masking: Sensitive data (passwords, tokens, API keys) are automatically masked
  4. Venv Detection: Automatically detects if you're in a virtual environment

Virtual Environment Awareness

When you're in a virtual environment:

  • Shelldog creates shelldog_history.txt at your project root (next to your venv folder)
  • Each project gets its own command history
  • No more mixing up commands from different projects!
my-project/
โ”œโ”€โ”€ venv/
โ”‚   โ””โ”€โ”€ .shelldog/          # Hidden config folder
โ”œโ”€โ”€ shelldog_history.txt     # Your project's command history! ๐Ÿ“
โ”œโ”€โ”€ src/
โ””โ”€โ”€ README.md

Privacy & Security

Shelldog automatically masks sensitive information:

# What you type:
export API_KEY=super_secret_key_123

# What gets logged:
export API_KEY=****

Protected patterns:

  • export VARNAME=value โ†’ export VARNAME=****
  • --password, --token, --api-key, --secret
  • Authorization headers in curl commands
  • And more!

๐Ÿ’ก Usage Examples

Example 1: Track Your Development Session

# Start your day
cd my-project
source venv/bin/activate
eval "$(shelldog follow -q)"

# Do your work
git pull origin main
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

# Later, review what you did
shelldog log --today

Example 2: Debug Like a Pro

# Something broke! What did you do?
shelldog log -n 50

# Find that specific command
shelldog log | grep docker

# See statistics
shelldog stats

Example 3: Document Your Setup

# After setting up a new environment
shelldog log > SETUP.md

# Now you have automatic documentation! ๐Ÿ“š

๐ŸŽจ Example Output

Starting Shelldog

$ shelldog follow

๐Ÿ• Woof! I'm watching you.

    Never forget what you did.
    Always know where you've been.
    I've got your back.

โœ“ Shelldog is now following your commands!

๐Ÿ“ Commands will be logged to:
   /path/to/project/shelldog_history.txt
   ๐ŸŽฏ Project root level logging!

๐ŸŽ‰ Stay pawsitive! ๐Ÿพ
============================================================

โœ“ Initialization complete!
============================================================

๐Ÿ• Activate the hook by running:
   eval "$(shelldog follow -q)"

Viewing History

$ shelldog log -n 5

๐Ÿ• Shelldog History:

================================================================================
[2025-10-08 14:23:45] pip install requests
[2025-10-08 14:24:12] python app.py
[2025-10-08 14:25:33] git add .
[2025-10-08 14:25:40] git commit -m "Add new feature"
[2025-10-08 14:25:55] git push origin main
================================================================================

๐Ÿ“Š Total entries: 5
๐Ÿ• *proud tail wag* I remembered everything!

Status Check

$ shelldog status

๐Ÿ• Shelldog Status:

==================================================
Tracking enabled:    โœ“ Yes
Shell hook active:   โœ“ Yes
Virtual env:         โœ“ Yes (venv-specific logging)
Venv path:           /opt/CodeRepo/SideProjects/shelldog/venv
Log file:            /opt/CodeRepo/SideProjects/shelldog/shelldog_history.txt
Log file exists:     โœ“ Yes
Logged commands:     247
==================================================

โœ“ Shelldog is actively tracking your commands! ๐Ÿ•
   Every great developer was once a beginner! ๐ŸŒŸ

โš™๏ธ Configuration

Log File Locations

  • In a venv: <project_root>/shelldog_history.txt
  • Global: ~/.shelldog/shelldog_history.txt

State Files

Shelldog keeps its configuration in:

  • In a venv: <venv>/.shelldog/
  • Global: ~/.shelldog/

๐Ÿค Shell Integration

Manual Activation

If you want to manually control when Shelldog watches:

# Start tracking
source ~/.shelldog/shelldog_hook.sh

# Stop tracking
source ~/.shelldog/shelldog_unhook.sh

Add to Shell Profile (Optional)

Want Shelldog to start automatically? Add to your ~/.bashrc or ~/.zshrc:

# Auto-start Shelldog in virtual environments
if [[ -n "$VIRTUAL_ENV" ]]; then
    eval "$(shelldog follow -q)" 2>/dev/null
fi

๐Ÿ› Troubleshooting

"Shelldog is enabled but not logging!"

Make sure the hook is active:

shelldog status

# If hook is not active, run:
eval "$(shelldog follow -q)"

"Commands are logged twice!"

This can happen if you source the hook multiple times. Run:

shelldog stop
eval "$(shelldog follow -q)"

"Shelldog logs its own commands!"

It shouldn't! Shelldog filters itself out. If you see this, please file a bug report! ๐Ÿ›

๐Ÿ“ What Gets Logged?

โœ… Logged

  • All shell commands
  • Script executions
  • Git commands
  • Package installations
  • Database migrations
  • Server starts/stops
  • Basically everything you type!

โŒ Not Logged

  • shelldog commands themselves
  • Internal shell functions
  • Empty commands
  • Shell initialization stuff

๐ŸŽ“ Pro Tips

  1. Review Daily: shelldog log --today at the end of the day
  2. Document Projects: shelldog log > COMMANDS.md for documentation
  3. Debug Sessions: shelldog log -n 50 to see recent commands
  4. Find Patterns: shelldog stats to see your most-used commands
  5. Clean Slate: shelldog clear when starting fresh

๐Ÿค” FAQ

Q: Does Shelldog slow down my terminal?
A: Nope! Logging happens asynchronously in the background. Zero performance impact.

Q: Is my sensitive data safe?
A: Yes! Shelldog automatically masks passwords, tokens, and API keys.

Q: Can I use this in production?
A: Shelldog is designed for development environments. Use caution in production!

Q: Does it work with tmux/screen?
A: Yes! Each session tracks independently.

Q: What shells are supported?
A: Bash and Zsh are fully supported.

๐ŸŽจ Why the Dog Theme?

Because:

  1. Dogs are loyal (like your command history should be)
  2. Dogs remember everything (especially treats)
  3. Dogs are always happy to help
  4. CLI tools deserve more personality! ๐ŸŽ‰

๐Ÿ“„ License

MIT License - See LICENSE file for details

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest features
  • ๐Ÿ”ง Submit pull requests
  • ๐ŸŽจ Improve documentation

๐Ÿ™ Acknowledgments

Built with โค๏ธ by developers who got tired of asking "wait, what command did I just run?"


Made with ๐Ÿ• and โ˜• by Ansuman Bhujabala

If Shelldog helps you, give him a treat! โญ this repo

๐Ÿ• *tail wagging intensifies*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shelldog-0.1.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shelldog-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file shelldog-0.1.0.tar.gz.

File metadata

  • Download URL: shelldog-0.1.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for shelldog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a84ed13b836ac7f4806670e7d7a28ed1b873d1e23dae8977c52d0da1959fd3e
MD5 42fa013c07b65c69ed3ebae06408d7df
BLAKE2b-256 1612389d0cad0722a4e53d39707653015d0f184d6bbb086ab837dabbc85113b7

See more details on using hashes here.

File details

Details for the file shelldog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: shelldog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for shelldog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f57726bd226888007729dc6ab478f62b02e44307c32aab860ace7b040b2b76f9
MD5 fb1b6d4bf7eecb7e4312326978ebb520
BLAKE2b-256 10ac38e91ce4433e15c23422745159666f4ea934c01165cf20b306279dda0068

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page