docs: add project readme and usage attribution

This commit is contained in:
2026-05-03 11:34:17 -04:00
parent c96da624fe
commit 2031ab0506
2 changed files with 53 additions and 1 deletions

View File

@@ -12,7 +12,7 @@
- `render.ts` — Width allocation, ANSI-aware truncation, dim text rendering.
- `modules/basic.ts` — Directory, context, model, thinking, and cost modules.
- `modules/usage.ts` — Usage bars/text modules and color gradient rendering.
- `usage/` — Provider usage fetchers copied/adapted from `oh-my-pi`.
- `usage/` — Provider usage fetchers adapted from `oh-my-pi`: https://github.com/can1357/oh-my-pi/tree/main/packages/ai/src/usage
- `providers/openai-codex/constants.ts`, `usage.ts`, `utils.ts` — Local shims/support for copied usage code.
## Conventions

52
README.md Normal file
View File

@@ -0,0 +1,52 @@
# pi-statusbar
A [pi](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent) extension that replaces the built-in footer with a configurable two-row statusbar.
## Features
- Directory, git branch, session, context, model, thinking, and cost modules
- Account usage modules for Claude/Anthropic, Codex/ChatGPT, and Z.ai
- Configurable rows and module placement in `config.ts`
- ANSI-aware rendering and truncation for narrow terminals
- Continuous green → yellow → red usage bar gradient
## Usage
Add this extension to pi via `package.json`:
```json
{
"pi": {
"extensions": ["./index.ts"]
}
}
```
Reload pi after changes with `/reload`.
Refresh account usage manually with:
```text
/refresh-usage
```
## Configuration
Edit `config.ts` to change the statusbar layout. Usage modules can be composed with options such as:
```ts
{ type: "usage", window: "current", style: "line", grow: 1 }
{ type: "usage", window: "week", style: "text", parts: ["percent", "time"] }
```
## Development
```sh
npm install
npm run lint
npm run typecheck
```
## Attribution
Provider usage fetchers in `usage/` are adapted from [`oh-my-pi`](https://github.com/can1357/oh-my-pi/tree/main/packages/ai/src/usage).