Skip to content

Latest commit

Β 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Ÿ cmd-tracker

A developer tool that auto-captures, categorizes and saves terminal commands per project for easy revision

npm version npm downloads npm total downloads GitHub stars GitHub issues License: MIT Node.js


🎯 What is cmd-tracker?

cmd-tracker is an npm package that automatically captures, categorizes and saves every terminal command you type in a project.

Perfect for:

  • πŸŽ“ Students learning Linux, Git, Docker, Angular etc.
  • πŸ‘¨β€πŸ’» Developers who want to track commands used in a project
  • πŸ“ Anyone who wants to revise terminal commands they've used

How it works

You work normally in terminal
         ↓
Commands auto-captured in background
         ↓
Saved to .tracker/commands.json in your project
         ↓
Run tracker list β†’ see entire command history

πŸ“¦ Installation

Install in your learning/project repo:

npm install @adithya-naik/cmd-tracker

πŸš€ Quick Start

Step 1 β€” Initialize in your repo:

npx tracker init

Step 2 β€” Enable automatic capture:

npx tracker hook
source ~/.bashrc                # bash
source ~/.zshrc                 # zsh (Mac)
source ~/.config/fish/config.fish  # fish

Step 3 β€” Work normally! Then revise:

npx tracker list

That's it! Every command you type is now saved automatically πŸͺ„


πŸ“‹ All Commands

Command Description
tracker init Initialize tracker in your project
tracker hook Enable automatic command capture
tracker unhook Disable automatic command capture
tracker list Show all saved commands
tracker list <category> Filter by category
tracker search <query> Search through commands
tracker stats Show statistics by category
tracker favorite <cmd> Toggle command as favorite
tracker favorites Show all favorites
tracker export Export as JSON
tracker export --csv Export as CSV (opens in Excel)
tracker clear Clear all commands
tracker clear <category> Clear specific category

πŸ—‚οΈ Categories

Commands are automatically categorized into:

Category Commands
πŸ”€ git git status, git push, git commit...
πŸ“¦ npm npm install, npx, npm run...
🐳 docker docker ps, docker build...
🐧 linux ls, cd, mkdir, chmod...
🟒 node node, nodemon...
πŸ”΄ angular ng new, ng serve, ng generate...
🐍 python python, pip install...
πŸ”· go go build, go run, go get...
β˜• java java, javac, mvn, gradle...
πŸ¦€ rust cargo build, cargo run, rustc...
πŸ”· dotnet dotnet run, dotnet build...
☸️ kubernetes kubectl get pods, helm install...
πŸ—„οΈ database mysql, psql, mongosh, redis-cli...
☁️ cloud aws s3 ls, gcloud, az login...
πŸ“₯ packageManagers yarn, pnpm, brew, snap...
πŸ§ͺ testing jest, vitest, playwright, cypress...
πŸ€– ai claude, gemini, opencode, aider...
πŸ“Œ others everything else

πŸ’‘ Usage Examples

Filter by category:

tracker list git      # see all git commands
tracker list linux    # see all linux commands
tracker list npm      # see all npm commands

Search commands:

tracker search "install"   # find all install commands
tracker search "git"       # find all git related commands

Save favorites for quick revision:

tracker favorite "git rebase -i HEAD~3"
tracker favorites   # see all starred commands

Export for sharing/backup:

tracker export          # creates tracker-export.json
tracker export --csv    # creates tracker-export.csv (opens in Excel!)

πŸ“ Project Structure

After running tracker init, a .tracker folder is created:

your-project/
β”œβ”€β”€ .tracker/
β”‚   └── commands.json   ← your personal command history
β”œβ”€β”€ your-files...
└── package.json

βœ… .tracker/ is automatically added to .gitignore Your command history stays local β€” never pushed to GitHub

πŸ”’ Automatic Secret Redaction

alt text

Security is a core priority of cmd-tracker. Before any command is written to .tracker/commands.json, it is automatically scanned for sensitive information.

If a command contains credentials such as API keys, access tokens passwords, or private keys, the sensitive value or credential segment is replaced with [REDACTED], while the rest of the command is preserved. This keeps your command history useful without exposing secrets.

Example

AWS example β€” Before

export AWS_SECRET_ACCESS_KEY=mySecretKey

AWS example β€” Saved as

export AWS_SECRET_ACCESS_KEY=[REDACTED]

Another example:

curl example β€” Before

curl -u sampleuser:examplePass https://api.example.com

curl example β€” Saved as

curl -u [REDACTED] https://api.example.com

πŸ›‘οΈ Supported Secret Types

The sanitizer automatically detects and redacts:

  • AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, etc.)
  • API keys
  • Access tokens
  • Authentication tokens
  • Passwords
  • Bearer tokens
  • HTTP Basic Authentication credentials
  • curl -u / curl --user credentials
  • GitHub Personal Access Tokens
  • GitLab Personal Access Tokens
  • Slack tokens
  • SSH private keys
  • PEM private keys

⚠️ Commands That Are Not Saved

If a command consists entirely of sensitive information (for example, only a GitHub token or a private key), cmd-tracker will not save it.

Example:

Input

ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Result

Command not saved (contains only sensitive data)

βœ… Why This Matters

This feature helps prevent accidental exposure of secrets while keeping your command history clean and useful.

  • πŸ”’ Prevents credentials from being stored in .tracker/commands.json
  • πŸ“– Preserves the readable parts of commands for future reference
  • 🚫 Avoids saving commands that contain nothing except sensitive information
  • πŸ’» Works automaticallyβ€”no configuration required

πŸ–₯️ Platform Support

Platform Support
Mac (zsh) βœ… Full support
Linux (bash) βœ… Full support
Windows (Git Bash) βœ… Supported
Windows (PowerShell) ⚠️ Manual save only
Fish βœ… Full support

Windows CMD/PowerShell users: use tracker save "command" manually or use Git Bash / WSL for automatic capture


🐟 Fish Shell Support

Install Fish Shell

Mac:

brew install fish

Ubuntu/Debian:

sudo apt install fish

Fedora:

sudo dnf install fish

Windows (WSL):

sudo apt install fish

Setup tracker in Fish

npx tracker init
npx tracker hook
source ~/.config/fish/config.fish

That's it! Every command you type in fish will now be saved automatically! πŸŽ‰


🀝 Contributing

Contributions are welcome! Feel free to:

  • Open an issue for bugs or feature requests
  • Submit a pull request

πŸ“„ License

MIT Β© Jatoth Adithya Naik


⭐ Star this repo if you find it useful!

GitHub β€’ npm β€’ Issues

Releases

Contributors

Languages