npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

aliasmate

v1.0.0

Published

A CLI utility to save, manage, and re-run shell commands with their working directories

Downloads

112

Readme

AliasMate

A powerful CLI utility to save, manage, and re-run shell commands with their working directories. Never lose track of useful commands again!

Why Use AliasMate?

As developers, we often spend time crafting complex commands, navigating to specific directories, and repeating the same sequences. AliasMate solves this by:

  • Saving Time: Quickly save and rerun frequently used commands without retyping them.
  • Reducing Errors: Execute commands in their correct directories, avoiding path-related mistakes.
  • Boosting Productivity: Focus on coding instead of remembering command syntax and locations.
  • Sharing Knowledge: Export and import commands to share workflows with your team.
  • Organizing Workflows: Keep your development environment clean and organized with named, reusable commands.

Whether you're a solo developer or part of a team, AliasMate helps you streamline your terminal workflow and maintain consistency across projects.

Features

  • 🚀 Save previous commands from shell history with one simple command
  • 📂 Remember working directories where commands should be executed
  • Quick execution of saved commands with optional path override
  • 📝 Interactive save with prompts for command and path
  • 📋 List all saved commands with their details
  • ✏️ Edit commands interactively
  • 🗑️ Delete unwanted commands
  • 📤 Export/Import commands for backup or sharing
  • 🎨 Beautiful colored output for better readability
  • 🔄 Cross-platform support (Linux, macOS, Windows)

Installation

Install globally via npm:

npm i -g aliasmate

Getting Started

  1. Install AliasMate using the command above.
  2. Save a command: After running any useful command in your terminal, save it with aliasmate prev <name>. For example:
    npm run build
    aliasmate prev build
  3. Run the command: From anywhere, execute it with aliasmate run <name>:
    aliasmate run build
  4. Explore more: Use aliasmate list to see all saved commands, aliasmate edit <name> to modify them, and more!

Usage

Save the Previous Command

Automatically capture the last command you ran:

# After running any command, save it
aliasmate prev <name>

Example:

npm run build
aliasmate prev build
# ✓ Saved command as "build"
#   Command: npm run build
#   Directory: /path/to/project

Run a Saved Command

Execute a saved command in its original directory:

aliasmate run <name>

Or override the directory:

aliasmate run <name> .
aliasmate run <name> /path/to/another/project

Example:

aliasmate run build
# Running: npm run build
# Directory: /path/to/project

Save a Command Interactively

Manually save a command with interactive prompts:

aliasmate save

You'll be prompted for:

  • Command name
  • Command to save
  • Working directory (defaults to current directory)

List All Saved Commands

View all your saved commands:

aliasmate list
# or
aliasmate ls

Output:

Saved commands (3):

  build
    Command: npm run build
    Directory: /path/to/project

  deploy
    Command: ./deploy.sh
    Directory: /path/to/scripts

  test
    Command: pytest tests/
    Directory: /path/to/python-project

Edit a Saved Command

Modify an existing command:

aliasmate edit <name>

Opens an interactive prompt to edit the command and directory.

Delete a Saved Command

Remove a command you no longer need:

aliasmate delete <name>
# or
aliasmate rm <name>

Export Commands

Backup your commands to a JSON file:

aliasmate export commands.json

Import Commands

Restore commands from a JSON file:

aliasmate import commands.json

If there are name conflicts, you'll be prompted to:

  • Overwrite existing commands
  • Skip imported commands
  • Rename imported commands

View Config Location

See where your commands are stored:

aliasmate config

Configuration

Commands are stored in:

  • Linux/macOS: ~/.config/aliasmate/config.json
  • Windows: %USERPROFILE%\.config\aliasmate\config.json

Command Reference

| Command | Aliases | Description | |---------|---------|-------------| | aliasmate prev <name> | - | Save the previous command from shell history | | aliasmate run <name> [path] | - | Run a saved command (optionally in a different directory) | | aliasmate save | - | Interactively save a new command | | aliasmate list | ls | List all saved commands | | aliasmate edit <name> | - | Edit a saved command | | aliasmate delete <name> | rm | Delete a saved command | | aliasmate export <file> | - | Export commands to a JSON file | | aliasmate import <file> | - | Import commands from a JSON file | | aliasmate config | - | Show config file location |

Examples

Common Workflows

1. Save and reuse a build command:

cd /my/project
npm run build -- --production
aliasmate prev build-prod
# Later, from anywhere:
aliasmate run build-prod

2. Save a deployment script:

aliasmate save
# Name: deploy
# Command: ./scripts/deploy.sh --env production
# Directory: /path/to/project

3. Run a command in a different directory:

aliasmate run test /path/to/different/project

4. Backup your commands:

aliasmate export ~/backups/aliasmate-$(date +%Y%m%d).json

5. Share commands with your team:

# Person A
aliasmate export team-commands.json

# Person B
aliasmate import team-commands.json

Tips

  • Use descriptive names for your commands (e.g., build-prod, test-unit, deploy-staging)
  • Regularly export your commands as backup
  • The prev command is great for saving complex commands you just figured out
  • Use path override to run the same command in multiple projects

Troubleshooting

"Could not retrieve previous command from history"

This happens when shell history is disabled or cannot be accessed. Make sure:

  • Your shell history is enabled
  • You have a history file (~/.zsh_history for zsh, ~/.bash_history for bash)

Commands not executing properly

  • Verify the saved directory exists: aliasmate list
  • Check if the command requires environment variables or specific shell configuration
  • Try running the command manually in the saved directory first

Development

To work on AliasMate locally:

# Clone the repository
git clone https://github.com/aliasmate/aliasmate.git
cd aliasmate

# Install dependencies
npm install

# Link for local development
npm link

# Test the CLI
aliasmate --help

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

Created with ❤️ for developers who love productivity tools.