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

# labx

> 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 labx

# Or use with bunx (no install needed!)
bunx labx

# Or install with bun
bun install -g labx
```

## Development

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

# Install dependencies
bun install

# Run in dev mode
bun run dev

# Build executable
bun run build
```

## Usage

### Quick Start

```bash
# Interactive selector
labx

# Search for existing directories
labx redis

# Show help
labx --help
```

### Shell Integration

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

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

Then use it as a function:

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

Or use directly with bunx (no install):

```bash
bunx labx          # Interactive selector
bunx labx 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) | labx (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.* 🏠