pi-one-ui 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.3.0] - 2026-08-30
10
+
11
+ ### Added
12
+
13
+ - Added a maintained English README with bidirectional language navigation.
14
+
15
+ ### Changed
16
+
17
+ - Use `~/.pi/agent/pi-one-ui.json` as the only configuration source.
18
+ - Persist settings with the canonical v1 `components` and `renderer` structure.
19
+
20
+ ### Removed
21
+
22
+ - Removed automatic loading and migration of `pi-mine-ui.json`, `zentui.json`, and `claude-code-style.json`.
23
+ - Removed legacy flat configuration fields, old style identifiers, and WorkingLine aliases.
24
+ - Removed the legacy `enableWorkingMessage` renderer option.
25
+
26
+ ### Migration
27
+
28
+ - Before upgrading, recreate or translate supported settings into the canonical `components` and `renderer` structure in `~/.pi/agent/pi-one-ui.json`.
29
+ - Use `/oneui` to write settings in the canonical format, then run `/reload`.
30
+
31
+ ## [0.2.2] - 2026-08-29
32
+
33
+ ### Fixed
34
+
35
+ - Reduced rendering lag when expanding settled tool groups by reusing cached child output.
36
+
37
+ [Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.3.0...HEAD
38
+ [0.3.0]: https://github.com/kerolt/pi-one-ui/compare/v0.2.2...v0.3.0
39
+ [0.2.2]: https://github.com/kerolt/pi-one-ui/compare/v0.2.1...v0.2.2
package/README.en.md ADDED
@@ -0,0 +1,256 @@
1
+ # pi-one-ui
2
+
3
+ [![npm version](https://img.shields.io/npm/v/pi-one-ui?style=flat-square)](https://www.npmjs.com/package/pi-one-ui)
4
+ [![Node.js](https://img.shields.io/badge/Node.js-%E2%89%A522.19-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/)
5
+ [![License](https://img.shields.io/github/license/kerolt/pi-one-ui?style=flat-square)](./LICENSE)
6
+
7
+ [简体中文](./README.md) | English
8
+
9
+ `pi-one-ui` is a unified TUI extension package for [Pi](https://pi.dev). It started as an effort to build a simple and polished terminal interface by combining, at the source level:
10
+
11
+ - the terminal shell capabilities of [pi-zentui](https://github.com/lmilojevicc/pi-zentui)
12
+ - the conversation rendering and productivity features of [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions)
13
+
14
+ The result is a single installable and configurable Pi package that continues to evolve through module refactoring, tighter ownership, and independent improvements.
15
+
16
+ ## Features
17
+
18
+ ### Unified interface layout
19
+
20
+ `pi-one-ui` organizes the Pi interface into the following layouts:
21
+
22
+ ```text
23
+ Header → Context → WorkingLine → Editor → Footer
24
+ ```
25
+
26
+ - **Header**: startup information, logo, and shortcut hints.
27
+ - **Context**: the conversation area, including user messages, assistant messages, thinking, tools, diffs, Markdown, and summaries.
28
+ - **WorkingLine**: working state, spinner, token/thought/elapsed information, and turn summaries.
29
+ - **Editor**: input editor, completion, metadata, Accent Rail, and Minimalist styles.
30
+ - **Footer**: current directory, Git, runtime, token, cost, and extension status information.
31
+ - **Overlay**: temporary interfaces such as the settings panel and Context Inspector, managed by a shared OverlayManager.
32
+
33
+ ### Built-in functionality
34
+
35
+ | Feature | Description | Entry point |
36
+ | --- | --- | --- |
37
+ | Unified settings panel | Organizes settings by Header, Context, WorkingLine, Editor, Footer, and Features | `/oneui` |
38
+ | Context Inspector | Shows context usage and previews the system prompt, memory, skills, tools, and messages | `/context` |
39
+ | Session reference | Searches previous Pi sessions or SubAgents and injects their useful context | `@` completion |
40
+ | Subagent autocomplete | Completes SubAgent names and delegation hints | `@` completion |
41
+ | Tool / Diff renderer | Provides unified rendering for tool calls, results, collapsed content, and Edit/Write diffs | Automatic |
42
+ | Markdown enhancement | Adds Mermaid, admonitions, URL linking, and related rendering improvements | Automatic |
43
+ | Built-in themes | Provides CC Dark and CC Light themes | `/theme` |
44
+ | Compatibility aliases | Optionally provides common command aliases | `/clear`, `/exit` |
45
+
46
+ ## Quick start
47
+
48
+ ### Requirements
49
+
50
+ - Node.js `>=22.19.0`
51
+ - Pi and related runtime packages `>=0.84.0`
52
+
53
+ ### Install from npm
54
+
55
+ ```bash
56
+ pi install npm:pi-one-ui
57
+ ```
58
+
59
+ ### Install from GitHub
60
+
61
+ ```bash
62
+ pi install git:github.com/kerolt/pi-one-ui
63
+ ```
64
+
65
+ After installation, reload extensions in Pi:
66
+
67
+ ```text
68
+ /reload
69
+ ```
70
+
71
+ Then open the unified settings panel:
72
+
73
+ ```text
74
+ /oneui
75
+ ```
76
+
77
+ ## Configuration
78
+
79
+ The configuration file is located at:
80
+
81
+ ```text
82
+ ~/.pi/agent/pi-one-ui.json
83
+ ```
84
+
85
+ Using the `/oneui` settings panel is recommended. The current configuration uses the v1 structure, for example:
86
+
87
+ ```json
88
+ {
89
+ "version": 1,
90
+ "components": {
91
+ "editor": {
92
+ "enabled": true,
93
+ "style": "opencode"
94
+ },
95
+ "userMessages": {
96
+ "enabled": true,
97
+ "style": "framed"
98
+ },
99
+ "workingLine": {
100
+ "enabled": true
101
+ },
102
+ "footer": {
103
+ "style": "starship"
104
+ }
105
+ },
106
+ "renderer": {
107
+ "mode": "on",
108
+ "diffViewMode": "auto"
109
+ }
110
+ }
111
+ ```
112
+
113
+ Available layout and renderer options may change between versions, so prefer configuring them through `/oneui`.
114
+
115
+ ### Canonical configuration policy
116
+
117
+ `pi-one-ui` reads and writes only:
118
+
119
+ ```text
120
+ ~/.pi/agent/pi-one-ui.json
121
+ ```
122
+
123
+ It does not automatically read, merge, or migrate historical configuration files, and it does not parse legacy flat fields or old style identifiers. If the file does not exist, runtime defaults are used in memory. The file is created only after the first settings change through `/oneui`. All persisted changes use the current v1 `components` and `renderer` structure.
124
+
125
+ ## Upstream origins and project evolution
126
+
127
+ `pi-one-ui` originally combined source from the following open-source projects. Many thanks to their maintainers and contributors for providing the initial foundation.
128
+
129
+ | Upstream project | Capabilities incorporated into `pi-one-ui` | Reference baseline |
130
+ | --- | --- | --- |
131
+ | [pi-zentui](https://github.com/lmilojevicc/pi-zentui) | Starship-style Footer, Opencode-style Editor, layouts, and shell capabilities | v0.21.0, commit `5341b38` |
132
+ | [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions) | Claude Code-style Context renderer, Tool/Diff rendering, Context Inspector, and references | v0.8.67, commit `dba37e5` |
133
+
134
+ Production code lives in `extensions/`. The project has since unified its entry point, configuration storage, lifecycle, layout ownership, overlays, and input routing. The current implementation is no longer equivalent to either upstream project and does not automatically track upstream changes.
135
+
136
+ The upstream projects provided the original foundation. Continued development focuses on turning these capabilities into one coherent product with clear seams and sustainable maintenance.
137
+
138
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for detailed module boundaries, event flow, and ownership conventions.
139
+
140
+ ## Local development
141
+
142
+ ### Clone the repository
143
+
144
+ ```bash
145
+ git clone https://github.com/kerolt/pi-one-ui.git
146
+ cd pi-one-ui
147
+ npm install
148
+ ```
149
+
150
+ Node.js `>=22.19.0` is required. If multiple Node.js versions are installed, switch to a compatible version first.
151
+
152
+ ### Run in development mode
153
+
154
+ Start Pi directly with the current source:
155
+
156
+ ```bash
157
+ npm run pi:dev
158
+ ```
159
+
160
+ This is equivalent to:
161
+
162
+ ```bash
163
+ pi --no-extensions -e ./extensions/index.ts
164
+ ```
165
+
166
+ You can also install the current package as a local link:
167
+
168
+ ```bash
169
+ npm run pi:install-local
170
+ ```
171
+
172
+ After changing the source, run the following command in Pi:
173
+
174
+ ```text
175
+ /reload
176
+ ```
177
+
178
+ ### Development commands
179
+
180
+ | Command | Purpose |
181
+ | --- | --- |
182
+ | `npm install` | Install dependencies |
183
+ | `npm run format` | Format source, tests, and configuration files |
184
+ | `npm run format:check` | Check formatting without modifying files |
185
+ | `npm run lint` | Run Biome checks |
186
+ | `npm run typecheck` | Run TypeScript type checking |
187
+ | `npm test` | Run all tests |
188
+ | `npm run test:node` | Run Node.js test runner tests |
189
+ | `npm run test:vitest` | Run Vitest tests |
190
+ | `npm run pack:check` | Preview the npm package contents |
191
+ | `npm run verify` | Run formatting, lint, type checking, and all tests |
192
+
193
+ Before submitting changes, run at least:
194
+
195
+ ```bash
196
+ npm run verify
197
+ npm run pack:check
198
+ ```
199
+
200
+ ### Test organization
201
+
202
+ Tests are grouped by domain:
203
+
204
+ - `tests/context-*`: Context content, tools, diffs, thinking, and mouse interaction.
205
+ - `tests/working-line-*`: WorkingLine and turn summaries.
206
+ - `tests/editor-*`: Editor, completion, metadata, transfer, and Accent Rail.
207
+ - `tests/footer-*`: Footer rendering, formatting, layout, and status.
208
+ - `tests/services-*`: Git, runtime, project, session, and telemetry data.
209
+ - `tests/shell-*`: Remaining layout lifecycle glue and standalone compatibility.
210
+
211
+ Changes involving the TUI lifecycle should specifically cover reloads, session tree rebuilds, compaction, regular/fullscreen TUI modes, headless mode, overlays, and third-party patch ownership.
212
+
213
+ ## Releases
214
+
215
+ User-visible changes and upgrade notes are maintained in [CHANGELOG.md](./CHANGELOG.md). Changes under development belong in `Unreleased` and are moved to a versioned section only during a release.
216
+
217
+ The project uses GitHub Actions for continuous integration and npm publishing:
218
+
219
+ - [`.github/workflows/ci.yml`](./.github/workflows/ci.yml) runs complete verification for pull requests and pushes to `main`.
220
+ - [`.github/workflows/publish.yml`](./.github/workflows/publish.yml) publishes to npm when a `v*.*.*` tag is pushed.
221
+
222
+ To publish a new version:
223
+
224
+ ```bash
225
+ # Ensure main is checked out and up to date
226
+ git switch main
227
+ git pull --ff-only origin main
228
+
229
+ # Run release checks
230
+ npm ci
231
+ npm run verify
232
+ npm run pack:check
233
+
234
+ # Select the SemVer increment
235
+ npm version patch # Backward-compatible fixes, for example 0.2.1 -> 0.2.2
236
+ # npm version minor # New features or breaking changes while the project is on 0.x
237
+ # npm version major # Breaking changes after a stable 1.x release
238
+
239
+ # Push the release commit and tag
240
+ git push origin main --follow-tags
241
+ ```
242
+
243
+ After the tag is pushed, the publish workflow verifies that the tag matches `package.json`, runs the full verification suite again, and publishes the public package through npm Trusted Publishing with provenance. Published npm versions cannot be overwritten, so never reuse an existing version or tag.
244
+
245
+ ## Contributing
246
+
247
+ GitHub issues and contributions are welcome. When submitting changes:
248
+
249
+ 1. Keep each commit focused on one primary purpose.
250
+ 2. Use a concise Conventional Commit message, for example `fix: prevent settings panel freeze after editor toggle`.
251
+ 3. Add or update tests for behavioral changes.
252
+ 4. Run `npm run verify` and `npm run pack:check` before submitting.
253
+
254
+ ## License
255
+
256
+ This project is released under the [MIT License](./LICENSE).
package/README.md CHANGED
@@ -1,133 +1,256 @@
1
1
  # pi-one-ui
2
2
 
3
- `pi-one-ui` 是一个统一的 Pi TUI 插件包,将 Zentui 的终端外壳能力与 Claude Code 风格的对话内容渲染合并到一个插件中。
3
+ [![npm version](https://img.shields.io/npm/v/pi-one-ui?style=flat-square)](https://www.npmjs.com/package/pi-one-ui)
4
+ [![Node.js](https://img.shields.io/badge/Node.js-%E2%89%A522.19-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/)
5
+ [![License](https://img.shields.io/github/license/kerolt/pi-one-ui?style=flat-square)](./LICENSE)
4
6
 
5
- ## 安装
7
+ 简体中文 | [English](./README.en.md)
6
8
 
7
- ```bash
8
- pi install /path/to/pi-one-ui
9
- # 或安装远程仓库
10
- pi install git:github.com/<your-account>/pi-one-ui
11
- ```
9
+ `pi-one-ui` 是一个面向 [Pi](https://pi.dev) 的统一 TUI 扩展包。项目的初衷是希望打造一个简单美观的 TUI 界面,最初通过源码级融合,将:
10
+
11
+ - [pi-zentui](https://github.com/lmilojevicc/pi-zentui)`pi-zentui` 的终端外壳能力
12
+ - [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions) 的对话内容渲染及生产力功能
13
+
14
+ 整合到同一个可安装、可配置的 Pi package 中,并在此基础上持续进行模块重构、职责收敛和独立优化。
15
+
16
+ ## 特性
12
17
 
13
- 安装后执行 `/reload`。
18
+ ### 统一的界面布局
14
19
 
15
- ## 统一入口
20
+ `pi-one-ui` 将 Pi 的交互界面划分为以下布局:
16
21
 
17
22
  ```text
18
- /oneui
23
+ Header → Context → WorkingLine → Editor → Footer
19
24
  ```
20
25
 
21
- `/oneui` 是唯一的公开管理命令。设置面板按照 TUI 的视觉 Layout 划分:
26
+ - **Header**:启动信息、Logo 和快捷键提示。
27
+ - **Context**:对话内容区,包含用户消息、Assistant 消息、Thinking、Tool、Diff、Markdown 和 Summary。
28
+ - **WorkingLine**:工作状态、spinner、token/thought/elapsed 信息和回合摘要。
29
+ - **Editor**:输入编辑器、completion、metadata、Accent Rail 和 Minimalist 样式。
30
+ - **Footer**:目录、Git、runtime、token、cost 和扩展状态等信息。
31
+ - **Overlay**:设置面板、Context Inspector 等临时浮层由统一的 OverlayManager 管理。
32
+
33
+ ### 内置功能
34
+
35
+ | 功能 | 说明 | 入口 |
36
+ | --------------------- | ---------------------------------------------------------------------- | ----------------- |
37
+ | 统一设置面板 | 按 Header、Context、WorkingLine、Editor、Footer 和 Features 组织设置 | `/oneui` |
38
+ | Context Inspector | 查看上下文占用,并预览 System prompt、Memory、Skills、Tools 和消息内容 | `/context` |
39
+ | Session reference | 搜索并注入历史 Pi session 或 SubAgent 的有效上下文 | `@` 补全 |
40
+ | Subagent autocomplete | 提供 SubAgent 名称补全和委派提示 | `@` 补全 |
41
+ | Tool / Diff renderer | 工具调用、结果、折叠内容和 Edit/Write diff 的统一展示 | 自动生效 |
42
+ | Markdown enhancement | 支持 Mermaid、提示框和 URL 链接化等增强渲染 | 自动生效 |
43
+ | Built-in themes | 提供 CC Dark 和 CC Light 主题 | `/theme` |
44
+ | Compatibility aliases | 可选提供常用命令别名 | `/clear`、`/exit` |
45
+
46
+ ## 快速开始
47
+
48
+ ### 环境要求
49
+
50
+ - Node.js `>=22.19.0`
51
+ - Pi 及其相关运行时包 `>=0.84.0`
52
+
53
+ ### 从 npm 安装
54
+
55
+ ```bash
56
+ pi install npm:pi-one-ui
57
+ ```
58
+
59
+ ### 从 GitHub 安装
60
+
61
+ ```bash
62
+ pi install git:github.com/kerolt/pi-one-ui
63
+ ```
64
+
65
+ 安装完成后,在 Pi 中重新加载扩展:
22
66
 
23
67
  ```text
24
- Header → Context → WorkingLine → Editor → Footer → Features → Presets
68
+ /reload
25
69
  ```
26
70
 
27
- 其中:
71
+ 然后使用统一入口打开设置:
28
72
 
29
- - **Header**:启动信息、Logo、快捷键提示。
30
- - **Context**:对话内容区,包含 User Message、Assistant Message、Thinking、Tool、Diff、Summary 和鼠标交互。
31
- - **WorkingLine**:Pi 的工作状态行、spinner、token/thought/elapsed 信息。
32
- - **Editor**:输入编辑器、completion、metadata、Accent Rail 和 Minimalist 样式。
33
- - **Footer**:目录、Git、runtime、token、cost、extension status 等信息。
34
- - **Features**:Context Inspector、Session Reference、Subagent Autocomplete、Aliases 等行为能力。
35
- - **Overlay**:设置面板和 Context Inspector 等临时浮层由统一 OverlayManager 跟踪。
73
+ ```text
74
+ /oneui
75
+ ```
36
76
 
37
77
  ## 配置
38
78
 
39
- 配置文件:
79
+ 配置文件位于:
40
80
 
41
81
  ```text
42
82
  ~/.pi/agent/pi-one-ui.json
43
83
  ```
44
84
 
45
- 当前仍兼容 v1 配置结构:
85
+ 推荐通过 `/oneui` 设置面板修改配置。当前配置仍使用 v1 结构,例如:
46
86
 
47
87
  ```json
48
88
  {
49
89
  "version": 1,
50
90
  "components": {
51
- "editor": { "enabled": true, "style": "opencode" },
52
- "userMessages": { "enabled": true, "style": "framed" },
53
- "workingLine": { "enabled": true },
54
- "footer": { "style": "starship" }
91
+ "editor": {
92
+ "enabled": true,
93
+ "style": "opencode"
94
+ },
95
+ "userMessages": {
96
+ "enabled": true,
97
+ "style": "framed"
98
+ },
99
+ "workingLine": {
100
+ "enabled": true
101
+ },
102
+ "footer": {
103
+ "style": "starship"
104
+ }
55
105
  },
56
106
  "renderer": {
57
107
  "mode": "on",
58
- "diffViewMode": "auto",
59
- "enableWorkingMessage": false
108
+ "diffViewMode": "auto"
60
109
  }
61
110
  }
62
111
  ```
63
112
 
64
- 所有读写已经经过统一 ConfigStore;旧的 `zentui.json`、`claude-code-style.json` 和 `pi-mine-ui.json` 会被兼容读取并保留。`enableWorkingMessage` 仍可被旧配置读取,但统一插件不会注册第二套 working-message 实现,WorkingLine 的唯一 owner 是本插件的 WorkingLine layout。
113
+ 不同布局和渲染器的可用选项会随版本变化,建议优先使用 `/oneui` 面板进行配置。
114
+
115
+ ### Canonical 配置约定
65
116
 
66
- ## 源码结构
117
+ `pi-one-ui` 只读取和写入:
67
118
 
68
119
  ```text
69
- extensions/
70
- index.ts # 唯一插件入口,创建 TuiRuntime
71
- app/
72
- runtime/ # TuiRuntime、state、事件和调度
73
- host/ # Pi API 的窄化 host ports
74
- config/ # ConfigStore 与配置领域解析
75
- ownership/ # Layout ownership
76
- overlay/ # OverlayManager、InputRouter、selector
77
- commands/ # /oneui and settings panel previews
78
- layouts/
79
- header/ # Header layout
80
- context/ # 原 Transcript:对话内容区
81
- message/ # User Message
82
- thinking/ # Thinking
83
- renderer/ # Tool、Diff、Markdown、Mouse
84
- summary/ # Agent summary
85
- working-line/ # WorkingLine 与 interaction summary
86
- editor/ # Editor 及其样式实现
87
- footer/ # Footer 及其布局/format/status
88
- features/
89
- aliases.ts
90
- context-inspector/ # /context,不是 Context 对话区
91
- flush-docked-bash.ts
92
- legacy/ # standalone compatibility implementation
93
- session-reference/
94
- subagent-autocomplete.ts
95
- services/ # Git、runtime、package、project、session 数据
96
- shared/ # ANSI、format、style、icons 等共享实现
97
- tools/ # 底层组件树、patch 和 terminal helpers
98
- vendor/ # 只读上游参考快照
120
+ ~/.pi/agent/pi-one-ui.json
99
121
  ```
100
122
 
101
- `TuiRuntime` 是唯一 composition root,并直接装配 Layout controllers、services 和 shared lifecycle effects。standalone compatibility harness 只位于 `tests/support/`,不进入安装包。
123
+ 不会自动读取、合并或迁移其他历史配置文件,也不会解析旧版扁平字段和旧 style 名称。配置文件不存在时,运行时直接使用内置默认值;首次通过 `/oneui` 修改设置时才创建文件。所有持久化修改统一写入当前 v1 的 `components` 和 `renderer` 结构。
124
+
125
+ ## 上游来源与项目演进
102
126
 
103
- ## 开发
127
+ `pi-one-ui` 以以下两个开源项目的源码为初始基础,并对它们进行源码级融合。在此再次感谢两个上游项目及其贡献者,他们为 `pi-one-ui` 提供了最初的实现基础。
128
+
129
+ | 上游项目 | 融入 `pi-one-ui` 的主要能力 | 参照baseline |
130
+ | --------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------- |
131
+ | [pi-zentui](https://github.com/lmilojevicc/pi-zentui) | Starship 风格 Footer、Opencode 风格 Editor、布局和 shell 能力 | v0.21.0,commit `5341b38` |
132
+ | [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions) | Claude Code 风格 Context renderer、Tool/Diff、Context Inspector 和引用功能 | v0.8.67,commit `dba37e5` |
133
+
134
+ 融合后的生产代码位于 `extensions/`。项目已经在原始实现之上统一入口、配置存储、生命周期、Layout ownership、Overlay 和输入路由,并会继续独立演进;当前实现不再等同于任一上游项目,也不会自动跟随上游同步。
135
+
136
+ 感谢两个上游项目及其贡献者。它们为 `pi-one-ui` 提供了最初的实现基础,而本项目后续的工作重点是将这些能力收敛为一个边界清晰、可持续维护的统一产品。
137
+
138
+ 更详细的模块边界、事件流和 ownership 约定参见 [ARCHITECTURE.md](./ARCHITECTURE.md)。
139
+
140
+ ## 本地开发
141
+
142
+ ### 获取源码
104
143
 
105
144
  ```bash
145
+ git clone https://github.com/kerolt/pi-one-ui.git
146
+ cd pi-one-ui
106
147
  npm install
107
- npm run typecheck
108
- npm test
109
- npm run pack:check
110
148
  ```
111
149
 
112
- 完整检查:
150
+ 项目要求 Node.js `>=22.19.0`。如果本机安装了多个 Node.js 版本,请先切换到满足要求的版本。
151
+
152
+ ### 开发模式运行
153
+
154
+ 直接使用当前源码启动 Pi:
155
+
156
+ ```bash
157
+ npm run pi:dev
158
+ ```
159
+
160
+ 该命令等价于:
161
+
162
+ ```bash
163
+ pi --no-extensions -e ./extensions/index.ts
164
+ ```
165
+
166
+ 也可以将当前 package 以本地链接方式安装:
167
+
168
+ ```bash
169
+ npm run pi:install-local
170
+ ```
171
+
172
+ 修改代码后,在 Pi 中执行:
173
+
174
+ ```text
175
+ /reload
176
+ ```
177
+
178
+ ### 常用开发命令
179
+
180
+ | 命令 | 用途 |
181
+ | ---------------------- | ---------------------------------- |
182
+ | `npm install` | 安装依赖 |
183
+ | `npm run format` | 格式化源码、测试和配置文件 |
184
+ | `npm run format:check` | 检查格式但不修改文件 |
185
+ | `npm run lint` | 运行 Biome 检查 |
186
+ | `npm run typecheck` | 执行 TypeScript 类型检查 |
187
+ | `npm test` | 运行全部测试 |
188
+ | `npm run test:node` | 运行 Node.js test runner 测试 |
189
+ | `npm run test:vitest` | 运行 Vitest 测试 |
190
+ | `npm run pack:check` | 预览 npm 实际打包内容 |
191
+ | `npm run verify` | 执行格式、lint、类型检查和全部测试 |
192
+
193
+ 提交修改前建议至少运行:
113
194
 
114
195
  ```bash
115
196
  npm run verify
197
+ npm run pack:check
116
198
  ```
117
199
 
118
- 测试按领域划分:
200
+ ### 测试组织
201
+
202
+ 测试按照功能领域划分:
119
203
 
120
- - `tests/context-*`:Context 内容区、Tool、Diff、Thinking 和鼠标行为。
204
+ - `tests/context-*`:Context 内容区、Tool、Diff、Thinking 和鼠标交互。
121
205
  - `tests/working-line-*`:WorkingLine 和 turn summary。
122
206
  - `tests/editor-*`:Editor、completion、metadata、transfer 和 Accent Rail。
123
207
  - `tests/footer-*`:Footer、Footer format/layout/status。
124
208
  - `tests/services-*`:Git、runtime、project、session 和 telemetry。
125
- - `tests/shell-*`:standalone compatibility tests for the remaining layout lifecycle glue。
209
+ - `tests/shell-*`:剩余布局生命周期 glue 和 standalone compatibility。
210
+
211
+ 涉及 TUI 生命周期的修改,应特别覆盖 reload、session tree rebuild、compact、regular/fullscreen TUI、headless mode、overlay 和第三方 patch ownership 等场景。
212
+
213
+ ## 发布
214
+
215
+ 用户可见变更和升级说明统一记录在 [CHANGELOG.md](./CHANGELOG.md)。开发中的变更先写入 `Unreleased`,正式发版时再归档到对应版本。
126
216
 
127
- 本地启动:
217
+ 项目使用 GitHub Actions 进行持续集成和 npm 发布:
218
+
219
+ - [`.github/workflows/ci.yml`](./.github/workflows/ci.yml):在 Pull Request 和 `main` 分支提交时执行完整验证。
220
+ - [`.github/workflows/publish.yml`](./.github/workflows/publish.yml):推送符合 `v*.*.*` 格式的 tag 时发布 npm 包。
221
+
222
+ 发布新版本时:
128
223
 
129
224
  ```bash
130
- npm run pi:dev
225
+ # 确认位于 main,并同步远程代码
226
+ git switch main
227
+ git pull --ff-only origin main
228
+
229
+ # 发布前检查
230
+ npm ci
231
+ npm run verify
232
+ npm run pack:check
233
+
234
+ # 按 SemVer 升级版本
235
+ npm version patch # 向后兼容的修复,例如 0.2.1 -> 0.2.2
236
+ # npm version minor # 0.x 阶段的新功能或破坏性变更
237
+ # npm version major # 进入稳定 1.x 后的破坏性变更
238
+
239
+ # 推送版本 commit 和 tag
240
+ git push origin main --follow-tags
131
241
  ```
132
242
 
133
- 上游快照保存在 `vendor/`,仅用于追踪和同步。不要直接修改 `vendor/` 或 `node_modules/`。
243
+ 推送 tag 后,发布 workflow 会校验 tag 版本与 `package.json` 版本一致,重新执行验证,并通过 npm Trusted Publishing 发布带 provenance 的公开包。已发布的 npm 版本不可覆盖,因此不要重复使用已经发布过的版本号或 tag。
244
+
245
+ ## 贡献
246
+
247
+ 欢迎通过 GitHub Issues 报告问题或提出改进建议。提交代码时建议:
248
+
249
+ 1. 保持每个 commit 只包含一个主要目的。
250
+ 2. 使用简洁的 Conventional Commit message,例如 `fix: prevent settings panel freeze after editor toggle`。
251
+ 3. 为行为修改补充或更新测试。
252
+ 4. 提交前运行 `npm run verify` 和 `npm run pack:check`。
253
+
254
+ ## 许可证
255
+
256
+ 本项目基于 [MIT License](./LICENSE) 发布。