# Install Pi Account Switcher as a Pi Package

This repo can be installed by Pi from GitHub now, and can be installed with `pi install npm:pi-account-switcher` after it is published to npm.

## Install from GitHub

Install globally:

```bash
pi install git:github.com/hieplp/pi-account-switcher
```

Or test for one Pi run without permanently installing:

```bash
pi -e git:github.com/hieplp/pi-account-switcher
```

Install project-locally, writing to `.pi/settings.json`:

```bash
pi install -l git:github.com/hieplp/pi-account-switcher
```

Then inside Pi:

```txt
/reload
/account-init
```

## Install like `pi install npm:pi-subagents`

The package is configured for npm publishing with:

- `keywords: ["pi-package", "pi-extension", ...]`
- `pi.extensions: ["./src/index.ts"]`
- Pi core packages in `peerDependencies`
- runtime dependency `zod` in `dependencies`
- package files limited to `src`, `README.md`, `USAGE.md`, and this install guide

### Publish to npm

Login to npm:

```bash
npm login
```

Optional: verify what will be published:

```bash
npm pack --dry-run
```

Publish:

```bash
npm publish
```

After publishing, users can install globally with:

```bash
pi install npm:pi-account-switcher
```

Or install project-locally with:

```bash
pi install -l npm:pi-account-switcher
```

To test without permanently installing:

```bash
pi -e npm:pi-account-switcher
```

## Scoped npm package option

If publishing under your npm scope, set the package name in `package.json` to:

```json
"name": "@hieplp/pi-account-switcher"
```

Publish scoped public packages with:

```bash
npm publish --access public
```

Install:

```bash
pi install npm:@hieplp/pi-account-switcher
```
