# pi-ccs-current-model

A small companion extension for [`pi-ccs`](https://www.npmjs.com/package/pi-ccs). It adds a fast model switcher restricted to the currently selected cc-switch provider.

## Why

`pi-ccs` intentionally uses a three-level picker:

```text
provider type → provider name → model
```

That is useful when changing providers, but repetitive when only changing models on the current provider. This extension adds the missing shortcut without modifying `pi-ccs` or the cc-switch SQLite database.

## Requirements

Install and configure `pi-ccs` first:

```bash
pi install npm:pi-ccs
```

Then install this extension from a local checkout:

```bash
pi install /absolute/path/to/pi-ccs-current-model
```

Restart Pi or run `/reload` afterwards.

## Commands

### Open the current provider's model picker

```text
/ccs-model
```

Alias:

```text
/ps-model
```

The picker:

- reads the current provider from `pi-ccs` selection state;
- fetches the provider's remote `/models` list when available;
- merges remote IDs with the provider's configured models;
- marks the active model with `★`;
- falls back to the configured list when the remote request fails;
- allows a manual model ID.

### Switch directly

```text
/ccs-model gpt-5.6-terra
```

This keeps the current provider and only replaces its model ID.

## Safety and compatibility

- Uses `pi-ccs`'s existing provider parser, header/fingerprint logic, model metadata overrides, Pi selection state, and cc-switch read-only database access.
- Does **not** write to `~/.cc-switch/cc-switch.db`.
- Does **not** store or print API keys.
- It requires `pi-ccs` `0.1.3` or compatible internals. If a future `pi-ccs` release changes these non-public module paths, update this extension accordingly.
- Do not also add a local patch that registers `/ccs-model` inside `pi-ccs`, or Pi will report a duplicate command.

## Development

```bash
npm install
npm run typecheck
npm run pack:check
```

Try it without permanent installation:

```bash
pi -e /absolute/path/to/pi-ccs-current-model
```

## License

MIT
