---
slug: "pi-order-extension"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/LinMingjing007/pi-order@main/README.md"
repo: "https://github.com/LinMingjing007/pi-order"
source_file: "README.md"
branch: "main"
---
# pi-order-extension

<p align="center">
  <strong>Reusable prompt templates for Pi, available through one simple <code>/order</code> command.</strong>
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/pi-order-extension"><img alt="npm version" src="https://img.shields.io/npm/v/pi-order-extension?color=cb3837&label=npm"></a>
  <a href="https://github.com/LinMingjing007/pi-order/actions/workflows/publish.yml"><img alt="Publish workflow" src="https://github.com/LinMingjing007/pi-order/actions/workflows/publish.yml/badge.svg"></a>
  <a href="./LICENSE"><img alt="License" src="https://img.shields.io/badge/license-MIT-green.svg"></a>
  <img alt="Node.js" src="https://img.shields.io/badge/node-%3E%3D22-43853d.svg">
  <img alt="Pi package" src="https://img.shields.io/badge/pi-package-blueviolet.svg">
</p>

`pi-order-extension` is a Pi extension for creating, editing, reusing, and organizing local prompt templates. It is useful for prompts you type repeatedly, such as code review instructions, weekly report templates, debugging checklists, release notes, or project-specific workflows.

## Highlights

- 🧩 **One command**: manage everything through `/order`.
- ⚡ **Fast reuse**: insert a saved template into the current Pi input box without auto-sending.
- 📝 **Descriptions**: add short descriptions so autocomplete results are easier to identify.
- 🔎 **Autocomplete**: complete subcommands and existing template names.
- 🧹 **Clear body in edit flow**: clear template content without deleting the template name or description.
- 💾 **Local-first**: templates are stored locally under `~/.pi/orders`.

## Installation

Install from npm:

```bash
pi install npm:pi-order-extension
```

Or install a fixed GitHub tag:

```bash
pi install git:git@github.com:LinMingjing007/pi-order.git@v0.1.1
```

Reload Pi after installing:

```text
/reload
```

## Quick start

Create a template:

```text
/order create code-review
```

Send a template into the current input box:

```text
/order send code-review
```

Edit a template, including description and body:

```text
/order edit code-review
```

During edit, choose either:

```text
编辑正文
清空正文
```

`清空正文` clears only the template body. The template name and description are preserved.

## Command reference

| Command | Description |
|---|---|
| `/order create <name>` | Create a new template, then edit its description and body. |
| `/order edit <name>` | Edit an existing template. You can edit body or clear body from the edit flow. |
| `/order edit <name> --clear` | Clear the template body directly. Kept for power users and autocomplete workflows. |
| `/order send <name>` | Insert the template body into the current Pi input box without sending. |
| `/order remove <name>` | Delete a template and its description. |
| `/order list` | List existing templates. |

Template names may contain letters, numbers, `_`, and `-`.

## Storage

Templates are stored locally:

```text
~/.pi/orders/<name>.md
~/.pi/orders/descriptions.json
```

This extension does not upload template content anywhere.

## Development

```bash
git clone https://github.com/LinMingjing007/pi-order.git
cd pi-order
npm install
npm test
```

Useful scripts:

```bash
npm run build
npm test
npm pack --dry-run
```

## Release

This repository publishes to npm through GitHub Actions.

1. Update code and tests.
2. Bump version:

   ```bash
   npm version patch --no-git-tag-version
   ```

3. Commit and tag:

   ```bash
   git add .
   git commit -m "Release vX.Y.Z"
   git tag -a vX.Y.Z -m "vX.Y.Z"
   git push origin main
   git push origin vX.Y.Z
   ```

4. GitHub Actions runs tests and publishes to npm automatically.

## License

MIT © LinMingjing007
