# Pi UI Minimal Extension

A minimal UI extension for [Pi coding agent](https://github.com/badlogic/pi-mono) that provides a cleaner TUI experience by:

1. **Hiding the footer** - Removes the default footer information (context size, model, tokens, cost)
2. **Removing dashed borders** - Eliminates the horizontal dashed lines above and below the user input area

## Installation

Place this extension in your Pi extensions directory:

```bash
cp -r /path/to/pi-ui-minimal ~/.pi/agent/extensions/
```

## Usage

Once installed, the extension will automatically activate on session start. No additional configuration is required.

## What It Does

### Hides Footer
The extension replaces the default footer with an empty one, giving you more vertical space for content.

### Removes Editor Borders
The default editor component renders with dashed lines:
```
──────────────
User input here
──────────────
```

This extension removes those borders:
```
User input here
```

### Prompt Variables
The editor shows a **bold** prompt with customizable variables:

```
[main 14:30:45] my-app > Type your message here
```

**Available variables:**
| Variable | Description | Example |
|----------|-------------|----------|
| `%d` | Directory basename | `my-app` |
| `%D` | Full directory path | `/Users/me/Projects/my-app` |
| `%cf%` | Context fill percentage | `45%` |
| `%gb%` | Git branch name | `main` |
| `%gs%` | Git status indicators | `*+~` |
| `%td%` | Time (HH:MM:SS) | `14:30:45` |
| `%%` | Literal percent sign | `%` |

**Git status indicators:**
- `*` - Modified files (unstaged)
- `+` - Staged changes
- `~` - Untracked files

## Configuration

### Environment Variable (`PI_PS1`)

Set the `PI_PS1` environment variable to customize the prompt format:

```bash
export PI_PS1="%d > "           # Directory: "my-app > "
export PI_PS1="[%gb% %td%] %d > "  # Branch + time: "[main 14:30:45] my-app > "
export PI_PS1="%cf% %d > "       # Context %: "45% my-app > "
export PI_PS1="> "               # Simple prompt
```

### Command (`/prompt-prefix`)

Use the `/prompt-prefix` command to set the prompt dynamically:

```
/prompt-prefix "%d > "
/prompt-prefix "%cf% %gb% > "
/prompt-prefix
```

Run `/prompt-prefix` without arguments to see the current prefix and all available variables.

### Priority

1. If `PI_PS1` is set, it takes precedence
2. Otherwise, uses saved prefix from `~/.config/pi-ui-minimal/config.json`
3. `/prompt-prefix` saves to config and persists across sessions

## How It Works

The extension is split into two concerns:

### FooterManager (`extensions/FooterManager.ts`)
- `createEmptyFooter()` - creates an empty footer component
- `hideFooter()` - installs the empty footer via `ctx.ui.setFooter()`

### MinimalEditor (`extensions/MinimalEditor.ts`)
- Extends `CustomEditor` to preserve all editor functionality
- Overrides `render()` to strip the first and last lines (borders)
- Maintains full autocomplete, history, and input handling

The entry point (`extensions/index.ts`) combines both modules on `session_start`.

## Benefits

- **Cleaner interface** - Less visual noise, more focus on content
- **More space** - Extra vertical space without the footer and borders
- **Preserved functionality** - All editor features remain intact
- **Minimal overhead** - Simple implementation with no performance impact

## Technical Details

- Built with TypeScript for type safety
- Extends the official `CustomEditor` class from `@mariozechner/pi-coding-agent`
- Compatible with all Pi themes and configurations
- Zero configuration required

## License

MIT
