npm package: @johnlindquist/try
Description: Fresh directories for every vibe - TypeScript/Bun port of tobi/try using Ink
Author: John Lindquist
Latest version: 0.1.1

# @johnlindquist/try

> Fresh directories for every vibe 🏠

A TypeScript/Bun port of [tobi/try](https://github.com/tobi/try) using **Ink** (React for CLIs).

Instantly navigate through experiment directories with fuzzy search, smart sorting, and auto-dating. Perfect for developers with ADHD who create `test`, `test2`, `new-test`, `actually-working-test` everywhere.

## Features

- 🎯 **Smart Fuzzy Search** - Not just substring matching
- ⏰ **Time-Aware** - Recently accessed directories float to the top
- 🎨 **Beautiful TUI** - Built with Ink (React for terminals)
- 📁 **Organized Chaos** - Auto-prefixes with dates: `2025-10-06-your-idea`
- ⚡ **Fast** - Powered by Bun runtime

## Tech Stack

- **Bun** - Fast JavaScript runtime
- **Ink 5.x** - React for interactive CLIs
- **React 18.x** - Component-based UI
- **TypeScript** - Type safety
- **meow** - Minimal CLI parser

## Installation

```bash
# Install globally with npm
npm install -g @johnlindquist/try

# Or use with bunx (no install needed!)
bunx @johnlindquist/try

# Or install with bun
bun install -g @johnlindquist/try
```

## Development

```bash
# Clone the repo
git clone https://github.com/johnlindquist/try.git
cd try

# Install dependencies
bun install

# Run in dev mode
bun run dev

# Build executable
bun run build
```

## Usage

### Quick Start

```bash
# Interactive selector
try

# Search for existing directories
try redis

# Show help
try --help
```

### Shell Integration

Add to your `~/.zshrc` or `~/.bashrc`:

```bash
# Generate the shell function
eval "$(try init)"
```

Then use it as a function:

```bash
try redis          # Jump to or create redis experiment
try                # Browse all experiments
```

Or use directly with bunx (no install):

```bash
bunx @johnlindquist/try          # Interactive selector
bunx @johnlindquist/try redis    # Search and create
```

### Keyboard Shortcuts

- **↑/↓** or **Ctrl-P/N** - Navigate
- **Enter** - Select or create directory
- **Backspace** - Delete character from search
- **ESC** or **Ctrl-C** - Cancel

## Configuration

Set `TRY_PATH` to change where experiments are stored:

```bash
export TRY_PATH=~/code/experiments
```

Default: `~/src/tries`

## How It Works

### Fuzzy Scoring Algorithm

Directories are scored based on:
1. **Match quality** - Character proximity and word boundaries
2. **Creation time** - Newer directories score higher
3. **Access time** - Recently used directories float to the top
4. **Name length** - Shorter names preferred for equal matches
5. **Date prefix bonus** - `YYYY-MM-DD-*` format gets priority

### Time Display

- `just now` - Less than 10 seconds
- `5m` - Minutes ago
- `3h` - Hours ago
- `2d` - Days ago
- `1mo` - Months ago
- `1y` - Years ago

## Comparison with Original

| Feature | tobi/try (Ruby) | @johnlindquist/try (TypeScript/Bun) |
|---------|-----------------|--------------------------|
| Runtime | Ruby | Bun |
| UI Framework | Raw ANSI | Ink (React) |
| Dependencies | 0 (single file) | Bundled (Ink, React) |
| CLI Parser | Built-in | meow |
| Type Safety | ❌ | ✅ TypeScript |
| Speed | Fast | Faster (Bun) |

## Why Bun + Ink?

- **Ink** - Battle-tested TUI framework (used by GitHub Copilot CLI and others)
- **React** - Component-based UI architecture
- **Bun** - Blazing fast runtime with built-in TypeScript support
- **TypeScript** - Type safety and better tooling

## Inspired By

- [tobi/try](https://github.com/tobi/try) - Original Ruby implementation

## License

MIT

---

*Built for developers with ADHD by developers with ADHD.*

*Your experiments deserve a home.* 🏠