pi-statusline

Claude Code-compatible command-driven statusline extension for the Pi coding agent

Package details

extension

Install pi-statusline from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-statusline
Package
pi-statusline
Version
0.0.1
Published
Apr 3, 2026
Downloads
156/mo · 15/wk
Author
hsingjui
License
MIT
Types
extension
Size
33.6 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-statusline

适用于 pi 的命令驱动状态栏扩展,输入 payload 与 Claude Code 的 statusline 方案兼容。

可在 pi 中直接复用现有的 Claude Code statusline 脚本。

For English, see README.md.

兼容 Claude Code 的 statusline 脚本。已有的 Claude Code statusline 命令,通常可以直接复用到 pi 中,或者只需极少修改。

目标

  • 尽可能复用现有的 Claude Code statusline 脚本
  • 通过 stdin 向外部命令传递类 Claude 的 JSON payload
  • 在 pi 中通过 footer 或 widget 渲染命令输出
  • 在 session 和 turn 边界触发刷新,并支持 debounce 与取消

兼容性说明

这个扩展的设计目标就是兼容 Claude Code statusline 的使用方式:

  • 支持使用 Claude Code 风格的 statusline 命令
  • 通过 stdin 向命令发送类 Claude 的 JSON payload
  • 方便将已有的 Claude Code statusline 脚本迁移到 pi

如果你已经有 Claude Code 的状态栏脚本,例如 ~/.claude/statusline.sh,通常可以直接在 pi 中复用。

安装方式

在 pi 中通过 npm 安装

pi install npm:pi-statusline

本地开发安装

方式 1:项目本地扩展

将本项目复制或软链接到:

.pi/extensions/pi-statusline/

方式 2:作为包安装

这个包通过以下配置暴露扩展入口:

{
  "pi": {
    "extensions": ["./src/index.ts"]
  }
}

pi 配置示例

在 pi 设置中加入 statusLine 配置:

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh"
  }
}

默认值如下:

  • placementfooter
  • padding0
  • widgetPlacementbelowEditor
  • debounceMs300
  • timeoutMs:可选,默认不启用

刷新时机

扩展会在以下事件触发时刷新:

  • session_start
  • turn_end
  • model_select
  • session_compact
  • session_tree

UI 集成

扩展会根据配置调用 ctx.ui.setFooter()ctx.ui.setWidget()

当前 payload 支持情况

目前已实现:

  • cwd
  • session_id
  • model
  • workspace
  • context_window
  • exceeds_200k_tokens

当前暂时以 null 占位:

  • transcript_path
  • version
  • cost
  • rate_limits
  • vim
  • agent
  • worktree

开发说明

当前项目采用 source-first 方式。pi 可以直接加载 TypeScript 扩展,因此这个初始脚手架不需要额外构建步骤。