<div align="center">

# pi-gen-license

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

> A [Pi](https://pi.dev) extension that generates open source license files — one command, one file.
>
> [中文文档](README_ZH.md)

</div>

## Quick Start

```bash
# Install as a Pi extension
pi install npm:pi-gen-license

# In Pi, run:
/gen-license mit
```

## Features

- **9 license types** — MIT, Apache 2.0, BSD 3-Clause, ISC, GPL 3.0, AGPL 3.0, LGPL 3.0, MPL 2.0, Unlicense
- **Dual interface** — slash command `/gen-license` for humans, tool `generate_license` for LLM
- **Auto-detect author** — reads `git config user.name` when no name is provided
- **Tab completion** — `/gen-license <TAB>` shows available license types

## Supported Licenses

| Type | License |
| --- | --- |
| `mit` | MIT License |
| `apache-2.0` | Apache License 2.0 |
| `bsd-3` | BSD 3-Clause License |
| `isc` | ISC License |
| `gpl-3.0` | GNU General Public License v3.0 |
| `agpl-3.0` | GNU Affero General Public License v3.0 |
| `lgpl-3.0` | GNU Lesser General Public License v3.0 |
| `mpl-2.0` | Mozilla Public License 2.0 |
| `unlicense` | The Unlicense |

## Usage

### Slash Command

```
/gen-license mit                    # MIT license, auto-detect author
/gen-license apache-2.0 hacxy       # Apache 2.0, specify author
/gen-license gpl-3.0 hacxy 2024     # GPL 3.0, specify author and year
```

### LLM Tool

Ask Pi naturally — the LLM will call `generate_license` automatically:

> "Generate an MIT license file for this project"

## Development

```bash
# Install dependencies
npm install

# Run with Pi (hot-reload)
npm run dev

# Lint & format
npm run lint
npm run format

# Type check
npm run typecheck
```

## License

[MIT](LICENSE)
