npm package: @parkerhendo/prompts
Description: A Bun-powered CLI for managing reusable prompts for language models.
Author: parkerhendo parker@parkerhendo.com
Latest version: 0.1.1

# prompts CLI

`prompts` is a Bun-powered command-line tool for storing and reusing prompt snippets. Each prompt is saved as a Markdown file inside a user-wide directory and can be fetched, piped, copied to the clipboard, or opened in your editor.

## Features
- Bun + TypeScript CLI built with Commander and Enquirer.
- Stores prompts as individual `.md` files under `~/.prompts` (or a custom directory).
- Supports inline arguments, piped stdin, and interactive flows.
- Clipboard integration with graceful fallback to stdout.
- Editor integration driven by `$VISUAL`, `$EDITOR`, or sane defaults.

## Installation

Install globally via npm:

```bash
npm install -g @parkerhendo/prompts
```

Once installed, you can invoke the CLI anywhere with `prompts`.

## Getting Started (Development)
1. Install dependencies: `bun install`
2. Run the tool directly in development: `bun run src/index.ts --help`
3. Bundle a single executable: `bun run build` (outputs `dist/prompts`)
4. Install globally (optional): `bun install --global .` — once installed you can invoke the CLI anywhere with `prompts`

You can link the bundled executable or point your shell to `dist/prompts` for everyday use.

## Command Reference
- `prompts list` — list saved prompt names (sorted alphabetically).
- `prompts add [name] [content]` — create or update a prompt. When content is omitted, pipe it via stdin or answer interactively in a TTY. Use `--force` to overwrite without confirmation.
- `prompts <name>` — print the prompt content to stdout, ideal for piping into other tools.
- `prompts copy <name>` — copy prompt text to the clipboard. Falls back to printing the content if clipboard access fails.
- `prompts edit <name>` — open the prompt in your editor, creating it first if needed.
- `prompts delete <name>` — remove a prompt. Requires confirmation unless `--force` is provided.
- `prompts open` — launch the prompts directory in your system file browser (Finder, Explorer, etc.).

### Examples
```bash
# Create from inline content
prompts add greeting "Hello there!"

# Pipe from another process
cat intro.md | prompts add intro --force

# Use a stored prompt
prompts greeting | llm-tool --prompt -

# Copy to clipboard (with fallback messaging if clipboard APIs are unavailable)
prompts copy intro
```

## Environment Variables
- `PROMPTS_HOME` — override the storage directory (defaults to `~/.prompts`).
- `PROMPTS_DISABLE_CLIPBOARD` — when set to `1`, `true`, or `yes`, clipboard writes are skipped and the content is printed instead (handy for CI).
- `PROMPTS_OPEN_COMMAND` — override the shell command used by `prompts open` (useful in CI/test environments).
- `VISUAL` / `EDITOR` — determines which editor `prompts edit` launches. Falls back to `nano` on Unix and `notepad` on Windows.

## Development
- Run tests: `bun test`
- Format/bundle: `bun run build`
- Link locally without installing globally: `bun link` (build runs automatically via the `prepare` script).
- The storage layer and CLI commands are covered with tests that isolate prompt data in temporary directories by wiring `PROMPTS_HOME`.

Contributions and prompt ideas welcome!