feat: add configurable pi statusbar extension
This commit is contained in:
42
AGENTS.md
Normal file
42
AGENTS.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# pi-statusbar Agent Guide
|
||||
|
||||
## Purpose
|
||||
|
||||
`pi-statusbar` is a pi extension that replaces the built-in footer with a configurable two-row statusbar. It combines native footer-like modules with account usage modules for providers such as Claude/Anthropic, Codex/ChatGPT, and Z.ai.
|
||||
|
||||
## Layout
|
||||
|
||||
- `index.ts` — Extension entrypoint, footer registration, refresh timers, slash command, auth lookup.
|
||||
- `config.ts` — User-facing layout/config. Prefer changing this for layout tweaks.
|
||||
- `types.ts` — Shared config/module/state types.
|
||||
- `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`.
|
||||
- `providers/openai-codex/constants.ts`, `usage.ts`, `utils.ts` — Local shims/support for copied usage code.
|
||||
|
||||
## Conventions
|
||||
|
||||
- Keep user layout changes in `config.ts` when possible.
|
||||
- Preserve copied provider logic in `usage/` unless fixing integration issues.
|
||||
- Use composable module config instead of subtype strings. For usage, prefer:
|
||||
|
||||
```ts
|
||||
{ type: "usage", window: "current", style: "line", grow: 1 }
|
||||
{ type: "usage", window: "week", style: "text", parts: ["percent", "time"], separator: " | " }
|
||||
```
|
||||
|
||||
- Usage fallback behavior should be stable/no-pop-in:
|
||||
- unknown/loading line bars render like 0% usage
|
||||
- unknown/loading percent renders `0%`
|
||||
- unknown/loading time renders `∞`
|
||||
- Usage bar colors are a continuous green → yellow → red gradient derived from usage percentage, not hard thresholds.
|
||||
- Rendering must remain ANSI-aware. If adding colors, update `visibleWidth`/`truncate` behavior as needed.
|
||||
- Text modules and separators should remain dim; filled usage bars may use gradient color.
|
||||
- Thinking level comes from `pi.getThinkingLevel()` and `thinking_level_select`, not `ctx.thinkingLevel`.
|
||||
|
||||
## Testing
|
||||
|
||||
- Reload pi with `/reload` after changes.
|
||||
- Test narrow terminal widths after render changes.
|
||||
- If terminal styling gets stuck during color work, reset with `printf '\033[0m'` or `reset`.
|
||||
Reference in New Issue
Block a user