omp packages

pi-ccstatusline0.1.2

Bring your ccstatusline layout to Pi, with Pi-owned settings and live session data.

uig77 Published 7 days ago MIT ~499 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-ccstatusline

想要 Claude Code 同款状态栏配置?把你调好的 ccstatusline,直接带进 Pi。

模型、推理强度、上下文用量、费用、工作目录和 Git 状态,都可以放在 Pi 的底栏里。颜色、分隔符、Powerline 和多行布局继续交给 ccstatusline,不用在 Pi 里重新写一套。

这个扩展调用真正的 ccstatusline 渲染器,把 Pi 的会话数据接进去。无需安装 Claude Code,扩展也不读取它的 settings.json。执行命令和刷新间隔由 Pi 自己管理。

布局示意,实际显示取决于你的 ccstatusline 配置:

provider/model | high | 32% | $0.12 | my-project | main

English

安装

需要 Node.js 22.19.0 或更新版本。开发与测试基于 Pi 1.3.0、ccstatusline 2.2.27,旧版尚未验证。

先安装外部渲染器。如果本机已有兼容版本的 ccstatusline,可以跳过第一条命令。

npm install -g ccstatusline@2.2.27
pi install npm:pi-ccstatusline

在 Pi 中执行 /reload,或重启 Pi。输入 /ccstatusline 可以切换自定义底栏和 Pi 默认底栏。

如果之前手动放过 ~/.pi/agent/extensions/ccstatusline.ts,安装包版本前请先停用旧副本,避免加载两次。也可以固定版本安装,例如 pi install npm:pi-ccstatusline@0.1.2。

配置归 Pi,样式归 ccstatusline

在 ~/.pi/agent/settings.json 中合并下面的 ccstatusline 字段,不要覆盖整个设置文件:

{
  "ccstatusline": {
    "command": "ccstatusline",
    "refreshInterval": 10
  }
}
  • command:渲染器的 shell 命令,默认 ccstatusline。只能填写你信任的命令,它会以当前用户的权限执行。
  • refreshInterval:定时刷新间隔,单位为秒,默认 10。有效正数会限制在 1 到 3600 秒之间,无效值回退到默认设置。
  • 配置只在扩展加载时读取,修改后执行 /reload,不是每次刷新都读文件。
  • 设置了 PI_CODING_AGENT_DIR 时,读取该目录下的 settings.json。扩展不读取项目目录的 .pi/settings.json 来决定执行命令。
  • 缺少配置、JSON 无效或字段类型不对时使用默认值,不修改原文件。旧的 ~/.claude/settings.json 不再参与配置解析,也不会被扩展修改。

环境变量按字段覆盖 Pi 配置:

环境变量 用途
PI_CCSTATUSLINE=off 完全停用扩展
PI_CCSTATUSLINE_COMMAND 覆盖渲染命令
PI_CCSTATUSLINE_REFRESH_MS 覆盖刷新间隔,注意这里的单位是毫秒

布局、颜色和组件顺序仍保存在 ccstatusline 的 ~/.config/ccstatusline/settings.json。运行 ccstatusline 可打开它的配置界面;无需选择安装到 Claude Code。如果已经有喜欢的布局,直接沿用即可。

仓库提供了一个不含自定义 shell 命令的基础布局示例。需要独立布局时,可以将它另存到自己的位置,然后在 Pi 的 command 中使用 ccstatusline 的 --config 参数,例如 ccstatusline --config "/absolute/path/pi-statusline.json",路径有空格时保留引号。不要直接覆盖已有布局。

带进 Pi 的不只是外观

  • 模型显示包含 provider,切换模型后可以看到当前使用的服务来源。
  • 推理强度、上下文大小和最近完成消息的 Token 用量来自 Pi,不伪造 Claude 会话。
  • 费用累计 Pi 会话记录中的 assistant、工具内部模型调用及 usage、压缩、分支摘要记录。数值取决于 Pi 报告的定价和 usage,不等同于供应商账单。
  • 消息结束、模型或推理强度变化、会话信息变化、Git 分支变化和终端宽度变化都会触发更新;定时刷新负责补充时钟等信息。密集事件会合并处理。
  • 其他扩展通过 ctx.ui.setStatus() 写入的状态会保留在单独一行。
  • 渲染失败时保留上次结果,首次失败则降级显示模型及可用的上下文百分比;渲染调用设有 10 秒超时和 64 KiB 输出限制。

使用边界

这是终端 UI 扩展,不向模型添加工具或提示词。它替换 Pi 的 Footer,因此不要同时启用另一个替换 Footer 的扩展。

ccstatusline 是外部程序,不包含在本扩展的发布包里。扩展会把会话 ID、模型、工作目录、Token 用量和费用等状态交给配置的命令;命令和 ccstatusline 自定义组件都需要由你信任。外部渲染器可能读写自己的配置和缓存,部分组件可能联网。

不是所有 Claude 专属组件都能变成 Pi 数据。例如 Claude 账号、订阅额度、沙箱和依赖 Claude transcript 的组件,不由这个适配器映射为 Pi 的对应信息。Pi 的 off、minimal 等推理等级也可能被 ccstatusline 标注为未知等级。

卸载

pi remove git:github.com/ACaiA-77/pi-ccstatusline@v0.1.1

然后执行 /reload。这不会删除外部 ccstatusline 程序或布局配置;Pi 中的 ccstatusline 设置字段可以保留,也可以自行移除。

如果使用固定版本安装,卸载源写成 pi remove npm:pi-ccstatusline@0.1.2。

开发

npm ci
npm run check
npm pack --dry-run

测试覆盖配置解析、数据适配、子进程渲染和扩展生命周期。CI 覆盖 Windows、Ubuntu 及 Node.js 22、24。自动化测试不能代替终端中的视觉检查。


English

Want your Claude Code-style statusline in Pi? Bring the ccstatusline layout you already like.

This extension feeds Pi session data into the real ccstatusline renderer and displays its output in Pi's footer. Keep your colors, separators, Powerline style and multi-line layout. Claude Code is not required, and the adapter does not read its settings file.

Install

Requires Node.js 22.19.0 or newer. Tested with Pi 1.3.0 and ccstatusline 2.2.27. The renderer is a separate dependency, not bundled with this package.

npm install -g ccstatusline@2.2.27
pi install npm:pi-ccstatusline

Skip the first command if a compatible renderer is already installed. Run /reload in Pi after installation. /ccstatusline toggles the footer. Disable any manually installed copy of this extension first. Pin a version with pi install npm:pi-ccstatusline@0.1.2 if you prefer.

Settings

Merge this field into ~/.pi/agent/settings.json; do not replace the whole file:

{
  "ccstatusline": {
    "command": "ccstatusline",
    "refreshInterval": 10
  }
}

command is a trusted shell command. refreshInterval is in seconds; valid positive values are clamped to 1 through 3600 seconds. Defaults are ccstatusline and 10 seconds. Invalid or missing settings fall back safely. Settings are read once when the extension loads; use /reload after edits. PI_CODING_AGENT_DIR selects an alternative agent directory. Project-level settings and Claude Code settings are not used to select the command.

PI_CCSTATUSLINE_COMMAND and PI_CCSTATUSLINE_REFRESH_MS override their fields independently; the latter uses milliseconds. PI_CCSTATUSLINE=off disables the extension.

Layout settings still belong to ccstatusline, normally in ~/.config/ccstatusline/settings.json. Run ccstatusline to edit them; installing into Claude Code is not required. An optional basic layout is included. Save it separately and use ccstatusline --config "/absolute/path/pi-statusline.json" as the command if you want a dedicated Pi layout. Preserve existing settings.

Behavior and boundaries

Pi supplies provider/model, thinking effort, context window, recent completed-message usage and cumulative session cost. Costs are Pi's reported estimates, not a billing statement. The footer refreshes on relevant session events and a timer, keeps other extensions' setStatus() messages, clips lines to terminal width and falls back when rendering fails. Each renderer call has a 10-second timeout and a 64 KiB output limit.

Terminal UI only. Do not enable multiple footer-replacement extensions at once. The configured command receives session ID, model, working directory, token and cost metadata and executes with your user permissions. Only use commands and custom widgets you trust. ccstatusline may access its own settings/cache or the network, depending on enabled widgets. Claude account, subscription, sandbox and transcript-specific widgets are not adapted to Pi. Some Pi thinking levels may appear as unknown values in ccstatusline.

To remove, run pi remove npm:pi-ccstatusline, then /reload. If you installed a pinned version, use its full source, for example pi remove npm:pi-ccstatusline@0.1.2. This leaves your renderer and layout settings intact. For development, run npm ci, npm run check and npm pack --dry-run.

License and credits

MIT. Built on Pi's extension API and the independently maintained ccstatusline renderer by Matthew Breedlove. This is a community adapter, not an official Anthropic or ccstatusline integration.