npm package: @laabroms/alias-cli
Description: Interactive TUI for managing shell aliases
Author: Lucas Aabroms
Latest version: 0.1.8

# Alias CLI

```
 █████╗ ██╗     ██╗ █████╗ ███████╗
██╔══██╗██║     ██║██╔══██╗██╔════╝
███████║██║     ██║███████║███████╗
██╔══██║██║     ██║██╔══██║╚════██║
██║  ██║███████╗██║██║  ██║███████║
╚═╝  ╚═╝╚══════╝╚═╝╚═╝  ╚═╝╚══════╝
```

> Interactive terminal UI for managing shell aliases

[![npm version](https://img.shields.io/npm/v/@laabroms/alias-cli.svg)](https://www.npmjs.com/package/@laabroms/alias-cli)
[![GitHub](https://img.shields.io/github/stars/laabroms/alias-cli?style=social)](https://github.com/laabroms/alias-cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Demo

![Demo](assets/demo.gif)

## Features

- ✨ **Interactive TUI** — keyboard-driven, no mouse needed
- 📝 **Add/Edit/Delete** aliases with clean modal dialogs
- 🔍 **Real-time search** — filter aliases as you type with arrow key navigation
- 🔍 **Live preview** — see your alias before saving
- 💾 **Auto-backup** — creates `.zshrc.backup` before changes
- 🎯 **Visual focus** — clearly see which field you're editing
- 🎨 **Color-coded UI** — easy to scan and navigate
- 📦 **Zero config** — works with `.zshrc` or `.bashrc` out of the box

## Installation

### Quick Install (bash)

```bash
curl -fsSL https://raw.githubusercontent.com/laabroms/alias-cli/main/install.sh | bash
```

### npm (global)

```bash
npm install -g @laabroms/alias-cli
```

### npx (no install)

```bash
npx @laabroms/alias-cli
```

### From source

```bash
git clone https://github.com/laabroms/alias-cli.git
cd alias-cli
npm install
npm run dev
```

## Usage

Run the CLI:

```bash
alias-cli
```

### Keyboard Shortcuts

**Main Screen:**
- `↑/↓` — Navigate aliases
- `a` — Add new alias
- `e` — Edit selected alias
- `d` or `Del` — Delete selected alias
- `/` — Search/filter aliases
- `c` — Clear search filter
- `q` — Quit

**Search Mode:**
- Type to filter aliases in real-time
- `↑/↓` — Navigate filtered results
- `Enter` — Edit selected alias
- `Esc` — Close search

**Add/Edit Modal:**
- `Tab` — Switch between Name and Command fields
- `Enter` — Save
- `Esc` — Cancel

**Delete Confirmation:**
- `y` or `Enter` — Confirm delete
- `n` or `Esc` — Cancel

## Example

Create a quick commit alias:

1. Run `alias-cli`
2. Press `a` to add
3. **Name:** `gc`
4. **Command:** `git add . && git commit -m`
5. Press `Enter` to save
6. Press `q` to quit
7. Paste the command (auto-copied to clipboard!) and press Enter
8. Use it: `gc "feat: add new feature"`

## How It Works

1. **Loads** aliases from your `.zshrc` or `.bashrc`
2. **Displays** them in an interactive list
3. **Saves** changes back to your shell config
4. **Backups** the original file before writing

All aliases are written to the end of your shell config with a comment:

```bash
# Aliases managed by alias-cli
alias gs="git status"
alias gc="git add . && git commit -m"
alias gp="git push origin main"
```

After making changes, the CLI automatically copies the `source` command to your clipboard — just paste and run!

## Requirements

- Node.js >= 18.0.0
- Terminal with ANSI color support

## Tech Stack

- **Ink** — React renderer for CLIs
- **ink-text-input** — Text input component
- **TypeScript** — Type safety
- **tsup** — Fast bundler
- **tsx** — TypeScript execution

## Contributing

PRs welcome! Please open an issue first to discuss what you'd like to change.

## License

MIT © [Lucas Abroms](https://github.com/laabroms)