@unifan/pi-unifan-zh 1.0.34 → 1.0.36

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/AGENTS.md CHANGED
@@ -30,13 +30,19 @@ pi-unifan-zh/
30
30
  │ │ │ ├── history-context.md # 历史上下文专家
31
31
  │ │ │ └── code-comments.md # 注释检查专家
32
32
  │ │ └── package.json # 独立子包: @unifan/pi-review-zh
33
- │ └── commit/ # ③ 智能 Git 提交助手 (/commit, /commit-push)
34
- │ ├── index.ts # 一键提交与推流命令
33
+ │ ├── commit/ # ③ 智能 Git 提交助手 (/commit, /commit-push)
34
+ │ │ ├── index.ts # 一键提交与推流命令
35
+ │ │ ├── src/
36
+ │ │ │ ├── git.ts # Git 执行引擎 (含自动变基 pull --rebase)
37
+ │ │ │ └── prompt.ts # Conventional Commits 中文提示词
38
+ │ │ └── package.json # 独立子包: @unifan/pi-commit-zh
39
+ │ └── workflow/ # ④ 复合工程工作流引擎 (/workflow)
40
+ │ ├── index.ts # 工具与输出过滤器注册
35
41
  │ ├── src/
36
- │ │ ├── git.ts # Git 执行引擎 (含自动变基 pull --rebase)
37
- │ │ └── prompt.ts # Conventional Commits 中文提示词
38
- │ └── package.json # 独立子包: @unifan/pi-commit-zh
39
- └── skills/ # 内置专业技能集
42
+ │ │ ├── tools/ # workflow_state, artifact_helper, session_checkpoint
43
+ │ │ └── filters/ # bash_output_filter, read_output_filter
44
+ │ └── package.json # 独立子包: @unifan/pi-workflow-zh
45
+ └── skills/ # 内置专业技能集 (00-next ~ 05-learn)
40
46
  ```
41
47
 
42
48
  ---
@@ -128,7 +134,12 @@ cd D:\program\my\pi-unifan-zh\extensions\commit
128
134
  npm version patch
129
135
  npm publish --access public
130
136
 
131
- # 4. 提交版本号变更到 Git 远端
137
+ # 4. 升级并发布 workflow 子包 (@unifan/pi-workflow-zh)(如有修改)
138
+ cd D:\program\my\pi-unifan-zh\extensions\workflow
139
+ npm version patch
140
+ npm publish --access public
141
+
142
+ # 5. 提交版本号变更到 Git 远端
132
143
  cd D:\program\my\pi-unifan-zh
133
144
  git add .
134
145
  git commit -m "chore(release): 升级版本号至 vX.Y.Z"
package/README.md CHANGED
@@ -17,11 +17,18 @@ pi-unifan-zh/
17
17
  ├── AGENTS.md # Developer and AI agent guidelines
18
18
  ├── README.md # English Documentation
19
19
  ├── README_zh.md # Chinese Documentation
20
- ├── extensions/ # 📦 Individual Extension Packages
20
+ ├── extensions/ # 📦 Extension Packages
21
21
  │ ├── sessions/ # 📜 ① Dual-pane session manager with live preview (Chinese)
22
22
  │ ├── review/ # 🔍 ② AI multi-agent code review suite (Daily/Lite/Perf/Full)
23
- │ └── commit/ # 📦 ③ Intelligent Conventional Commits assistant (Chinese)
24
- └── skills/ # 🎯 Custom prompt skills library
23
+ │ ├── commit/ # 📦 ③ Intelligent Conventional Commits assistant (Chinese)
24
+ │ └── workflow/ # 🔄 ④ Compound Engineering Workflow engine (State/Checkpoints/Filters)
25
+ └── skills/ # 🎯 Compound Engineering Skills (00-next ~ 05-learn)
26
+ ├── 00-next/ # 🚦 Router & orchestrator (inspects repo state, recommends next step)
27
+ ├── 01-brainstorm/ # 💡 Discovery & flexible interactions (single/multi-select/custom text)
28
+ ├── 02-plan/ # 📐 TDD architecture planning & Implementation Units
29
+ ├── 03-work/ # 🛠️ Strict TDD coding execution & checkpoint resume
30
+ ├── 04-review/ # 🧐 Code review, spec verification & regression testing
31
+ └── 05-learn/ # 📝 Lightweight solution cards & knowledge compounding
25
32
  ```
26
33
 
27
34
  ---
@@ -49,19 +56,44 @@ pi install D:/program/my/pi-unifan-zh
49
56
 
50
57
  ### Option B: Install Individual Extensions
51
58
 
59
+ Each extension is published as a standalone npm package and can be installed individually:
60
+
61
+ > 💡 **Note**: Pi CLI's `git:` source only supports cloning the entire repository root. For **installing individual extensions**, use the recommended `npm:` method or local paths.
62
+
52
63
  #### 1. Install `sessions` (Session Manager with TUI Preview):
53
64
  ```bash
65
+ # Via npm
54
66
  pi install npm:@unifan/pi-sessions-zh
67
+ # Or via local path
68
+ pi install D:/program/my/pi-unifan-zh/extensions/sessions
55
69
  ```
56
70
 
57
71
  #### 2. Install `review` (AI Parallel Code Review Suite):
58
72
  ```bash
73
+ # Via npm
59
74
  pi install npm:@unifan/pi-review-zh
75
+ # Or via local path
76
+ pi install D:/program/my/pi-unifan-zh/extensions/review
60
77
  ```
61
78
 
62
79
  #### 3. Install `commit` (Intelligent Git Commit Assistant):
63
80
  ```bash
81
+ # Via npm
64
82
  pi install npm:@unifan/pi-commit-zh
83
+ # Or via local path
84
+ pi install D:/program/my/pi-unifan-zh/extensions/commit
85
+ ```
86
+
87
+ #### 4. Install `workflow` (Compound Engineering Engine & Skills):
88
+ > Includes `/workflow` command, checkpoint persistence, token filters, and all 6 workflow skills (`00-next` ~ `05-learn`).
89
+ ```bash
90
+ # Via npm
91
+ pi install npm:@unifan/pi-workflow-zh
92
+ # Or via local path
93
+ pi install D:/program/my/pi-unifan-zh/extensions/workflow
94
+
95
+ # Recommended peer question UI extension:
96
+ pi install npm:@juicesharp/rpiv-ask-user-question
65
97
  ```
66
98
 
67
99
  ---
@@ -134,6 +166,51 @@ pi install npm:@unifan/pi-commit-zh
134
166
 
135
167
  ---
136
168
 
169
+ ### 4. 🔄 `workflow` & Compound Engineering Workflow Suite
170
+ Turn your AI coding agent into a disciplined software engineer through an iterative stage-gated pipeline:
171
+
172
+ ```text
173
+ 00-next ──> 01-brainstorm ──> 02-plan ──> 03-work ──> 04-review ──> 05-learn
174
+ (Router) (Discovery) (TDD Plan) (Execution) (Review) (Compounding)
175
+ ```
176
+
177
+ - **Commands & Tools**:
178
+ - **`/workflow`**: Inspect current project stage, artifact counts, active autonomous driving loop progress, and recommended next skill.
179
+ - **`workflow_state` tool**: Automatically scans `docs/` and `.context/checkpoints/` state.
180
+ - **`artifact_helper` tool**: Resolves standardized artifact paths for requirements, plans, and solutions.
181
+ - **`session_checkpoint` tool**: Saves and restores execution breakpoints at the Implementation Unit level — resume right from where you left off.
182
+ - **6 Built-in Pipeline Skills**:
183
+ - **`00-next` (Router & Orchestrator)**: Say `continue` or type `/skill:00-next`, and it automatically guides you to the right next step.
184
+ - **`01-brainstorm` (Requirements Discovery)**: Clarifies scope and architecture decisions. **Pairs with `@juicesharp/rpiv-ask-user-question`** for flexible interactions: single-select (1-9 hotkeys) for mutually exclusive choices, multi-select checkboxes for feature lists, and custom text inputs.
185
+ - **`02-plan` (Architecture Planning)**: Decomposes requirements into TDD Implementation Units following The Ladder minimalism principles.
186
+ - **`03-work` (Autonomous Loop TDD Coding)** 🚀: **Built-in autonomous continuation engine similar to `goal`**. Directly invoking `/skill:03-work` starts a background cross-turn driver that sequentially executes Implementation Units with red-green-refactor, **never stopping until all planned units are 100% completed**! Supports checkpoint resumption and strict Stop-The-Line policy. Type `pause`, `stop`, or press `Esc` to pause anytime.
187
+ - **`04-review` (Quality & Spec Review)**: Verifies git diff, checks Spec contract compliance, and ensures clean regression tests.
188
+ - **`05-learn` (Knowledge Compounding)**: Lightweight, pragmatic pitfall compounding into `docs/solutions/` — zero noise, only non-trivial insights.
189
+ - **Context Optimizers (Token Savers)**:
190
+ - **`bash` smart filter**: Automatically summarizes verbose command outputs (`npm install`, verbose logs), saving 80%+ context tokens.
191
+ - **`read` smart filter**: Compresses oversized lockfiles (e.g. `package-lock.json`) and long logs into compact structural summaries.
192
+
193
+ ### 🔄 How 03-work Autonomous Loop Works
194
+
195
+ Traditional AI coding tools stop after each turn, asking for user confirmation before doing the next step. `03-work` natively integrates the `WorkLoopDriver` engine:
196
+ 1. **Lifecycle Event Hook**: Binds to Pi's `agent_settled` event to verify execution state immediately after each turn finishes.
197
+ 2. **Bi-directional Checkpoint Sync**: Re-reads `.context/checkpoints/` and the active plan to ensure in-memory and disk states match.
198
+ 3. **Autonomous Continuation**: If units remain, dispatches a follow-up turn (`deliverAs: "followUp"`), driving red-green-refactor cycles autonomously across turns until all units pass.
199
+ 4. **Safety Valves**:
200
+ - **Stop-The-Line**: Automatically pauses upon 3 consecutive failures on the same unit, preserving exact error context.
201
+ - **50-Turn Safety Threshold**: Prevents runaway looping.
202
+ - **Interactive Pause**: Hit `Esc` or type `pause` / `stop` anytime to safely suspend.
203
+ 5. **Auto-Handover**: Automatically cascades into `/skill:04-review` once all units are verified green.
204
+
205
+ ---
206
+
207
+ ## 💡 Acknowledgments & References
208
+
209
+ The Compound Engineering workflow pipeline in this repository draws deep architectural inspiration and reference from:
210
+ - **[`@leing2021/super-pi`](https://github.com/leing2021/super-pi)**: Special thanks to `super-pi` for its pioneering design of Pi-native Compound Engineering pipelines, checkpoint resumes, and artifact management patterns. In this project, we re-architected the terminal interaction to unlock multi-select capabilities, introduced the **`00-next` router**, streamlined **`05-learn`**, and fully integrated **`@juicesharp/rpiv-ask-user-question`** for rich terminal UI dialogs.
211
+
212
+ ---
213
+
137
214
  ## 📄 License
138
215
 
139
216
  MIT License.
package/README_zh.md CHANGED
@@ -15,11 +15,18 @@ pi-unifan-zh/
15
15
  ├── AGENTS.md # 开发者与智能体规范指南
16
16
  ├── README.md # English Documentation
17
17
  ├── README_zh.md # 中文说明文档
18
- ├── extensions/ # 📦 独立插件集
18
+ ├── extensions/ # 📦 扩展插件集
19
19
  │ ├── sessions/ # 📜 ① 历史会话管理器(双栏实时预览与恢复·中文增强版)
20
20
  │ ├── review/ # 🔍 ② AI 代码审查套件(日常3专家 / 极速单兵 / 性能探针 / 全量会诊)
21
- │ └── commit/ # 📦 ③ 智能 Git 提交助手(Conventional Commits 纯中文规范版)
22
- └── skills/ # 🎯 自定义技能库
21
+ │ ├── commit/ # 📦 ③ 智能 Git 提交助手(Conventional Commits 纯中文规范版)
22
+ │ └── workflow/ # 🔄 ④ 复合工程工作流引擎(状态感知 / 断点续跑 / 输出压缩)
23
+ └── skills/ # 🎯 复合工程流程技能库 (00-next ~ 05-learn)
24
+ ├── 00-next/ # 🚦 流程导航调度器(自动分析仓库产物并推荐下一步)
25
+ ├── 01-brainstorm/ # 💡 需求发现与交互对齐(单选/多选复选框/开放问答)
26
+ ├── 02-plan/ # 📐 TDD 架构规划与 Implementation Units 拆解
27
+ ├── 03-work/ # 🛠️ 严格 TDD 编码执行与断点持久化
28
+ ├── 04-review/ # 🧐 代码审查与回归测试闭环
29
+ └── 05-learn/ # 📝 极简避坑指南与经验复利沉淀
23
30
  ```
24
31
 
25
32
  ---
@@ -47,19 +54,44 @@ pi install D:/program/my/pi-unifan-zh
47
54
 
48
55
  ### 模式 B:按需单独安装单个插件
49
56
 
57
+ 每个插件均已独立打包并发布至 npm,可根据需要挑选单独安装(互不依赖,开箱即用):
58
+
59
+ > 💡 **提示**:Pi CLI 的 `git:` 方式仅支持安装整个仓库根目录;若需**按模块单独安装**,请使用推荐的 `npm:` 方式或本地绝对路径。
60
+
50
61
  #### 1. 仅安装 `sessions`(历史会话管理器·中文版):
51
62
  ```bash
63
+ # npm 在线单独安装
52
64
  pi install npm:@unifan/pi-sessions-zh
65
+ # 或本地路径安装
66
+ pi install D:/program/my/pi-unifan-zh/extensions/sessions
53
67
  ```
54
68
 
55
69
  #### 2. 仅安装 `review`(AI 代码审查系统·中文版):
56
70
  ```bash
71
+ # npm 在线单独安装
57
72
  pi install npm:@unifan/pi-review-zh
73
+ # 或本地路径安装
74
+ pi install D:/program/my/pi-unifan-zh/extensions/review
58
75
  ```
59
76
 
60
77
  #### 3. 仅安装 `commit`(智能 Git 提交助手·中文版):
61
78
  ```bash
79
+ # npm 在线单独安装
62
80
  pi install npm:@unifan/pi-commit-zh
81
+ # 或本地路径安装
82
+ pi install D:/program/my/pi-unifan-zh/extensions/commit
83
+ ```
84
+
85
+ #### 4. 仅安装 `workflow`(复合工程工作流引擎与全套技能·中文版):
86
+ > 包含 `/workflow` 命令、断点续跑、Token压缩器以及完整的 6 大流程技能 (`00-next` ~ `05-learn`)。
87
+ ```bash
88
+ # npm 在线单独安装
89
+ pi install npm:@unifan/pi-workflow-zh
90
+ # 或本地路径安装
91
+ pi install D:/program/my/pi-unifan-zh/extensions/workflow
92
+
93
+ # 推荐搭配安装交互提问工具(支持现代终端多选复选框与单选):
94
+ pi install npm:@juicesharp/rpiv-ask-user-question
63
95
  ```
64
96
 
65
97
  ---
@@ -139,6 +171,51 @@ pi install npm:@unifan/pi-commit-zh
139
171
 
140
172
  ---
141
173
 
174
+ ### 4. 🔄 `workflow` 与复合工程流 (Compound Engineering)
175
+ 本套件内嵌完整的 **Pi 原生复合工程流体系**,将 AI 辅助编程从“随性写代码”升级为“严格的工程流水线”:
176
+
177
+ ```text
178
+ 00-next ──> 01-brainstorm ──> 02-plan ──> 03-work ──> 04-review ──> 05-learn
179
+ (智能调度) (需求澄清) (TDD计划) (断点编码) (质量审查) (极简复盘)
180
+ ```
181
+
182
+ - **核心命令与工具**:
183
+ - **`/workflow`**:快速在终端查看当前项目工作流阶段、各产物数量、当前自主循环进度与下一步推荐技能。
184
+ - **`workflow_state`** 工具:自动扫描 `docs/` 与 `.context/checkpoints/` 状态。
185
+ - **`artifact_helper`** 工具:规范化解析和建立需求、计划与避坑文档。
186
+ - **`session_checkpoint`** 工具:以 Implementation Unit 为粒度记录执行断点,**写一半中断后再次启动自动从断点续跑,绝不重头重来**。
187
+ - **6 大内置流程技能**:
188
+ - **`00-next`(智能路标)**:用户随口说 `continue`、`下一步` 或输入 `/skill:00-next`,自动探查当前进度并无缝引导至下一个环节。
189
+ - **`01-brainstorm`(需求发现)**:引导需求澄清,**灵活调用 `@juicesharp/rpiv-ask-user-question`**:互斥方案用单选(1-9直选)、模块清单用多选复选框、开放问题自由输入,自然对齐技术方案。
190
+ - **`02-plan`(计划拆解)**:将需求拆解为包含验证命令与改动清单的 Implementation Units,坚持极简阶梯(The Ladder)原则。
191
+ - **`03-work`(跨回合自主循环驱动编码)** 🚀:**原生内置类似 `goal` 的连续自动驱动引擎**。直接使用 `/skill:03-work`(或要求执行计划)启动后,后台引擎按计划中的 Implementation Units 逐单元跨回合自主推进“红-绿-重构”,**不做完规划任务绝不停机**!支持断点续跑与遇错即停(Stop-the-line)硬门禁;如需暂停,输入 `暂停`、`pause` 或按 `Esc` 即可。
192
+ - **`04-review`(审查闭环)**:全量代码审查、Spec 需求符合度核验、回归测试绿灯检查。
193
+ - **`05-learn`(极简知识复盘)**:价值门禁驱动,仅沉淀非平凡的疑难避坑卡片至 `docs/solutions/`,坚决不制造文档噪音。
194
+ - **内置上下文优化黑科技 (Token Saver)**:
195
+ - **`bash` 输出智能过滤器**:自动压缩长终端命令输出(如 `npm install`、长日志),保留首尾关键行,节省 80%+ 上下文 Token!
196
+ - **`read` 输出智能过滤器**:智能压缩 `package-lock.json` 等超大文件,只保留版本和依赖概览。
197
+
198
+ ### 🔄 03-work 跨回合自主循环工作原理
199
+
200
+ 传统 AI 编程助手往往在单个回合输出后便停下等待用户确认,导致长流程编码被频繁打断。`03-work` 原生集成了 `WorkLoopDriver` 跨回合自主驱动引擎:
201
+ 1. **事件级生命周期监听**:挂载 Pi 的 `agent_settled` 事件,在每回合执行完毕且环境就绪时自动触发状态核验。
202
+ 2. **磁盘断点双向校验**:实时扫描 `.context/checkpoints/` 与规划文件中的 Implementation Units,确保内存与磁盘状态强一致。
203
+ 3. **自主连续推进**:若存在剩余未完成单元,驱动器防抖调度后续消息(`deliverAs: "followUp"`),实现跨回合无人值守自主编码与单测验证,**不做完计划绝不停机**。
204
+ 4. **多重安全防护阀**:
205
+ - **Stop-The-Line 遇错即停**:同一单元若连续 3 次排查修复失败,强制停机并完整记录错误现场,杜绝无效死循环与 Token 浪费。
206
+ - **50 轮安全轮次上限**:防止异常任务无休止推进。
207
+ - **随时安全打断**:按下 `Esc` 或输入 `暂停` / `pause`,随时安全挂起循环。
208
+ 5. **闭环自动流转**:全量单元绿灯通过后,自动交接调度 `/skill:04-review` 进行代码审查与回归验证。
209
+
210
+ ---
211
+
212
+ ## 💡 致谢与参考 (Acknowledgments)
213
+
214
+ 本扩展库中的复合工程工作流(Compound Engineering)模块深度参考并借鉴了以下优秀开源项目的架构思想:
215
+ - **[`@leing2021/super-pi`](https://github.com/leing2021/super-pi)**:特别致谢 `super-pi` 项目对复合工程流流水线、断点续传(Checkpoints)与产物治理模式的探索与启发。本项目在汲取其精髓的基础上,全面重构了终端交互体验,解除了只能单选的限制,引入了 **`00-next` 智能调度导航**、**极简避坑复盘 `05-learn`**,并深度打通了 **`@juicesharp/rpiv-ask-user-question`** 的现代多选复选框终端交互体系。
216
+
217
+ ---
218
+
142
219
  ## 📄 开源许可证
143
220
 
144
221
  本项目基于 [MIT License](./LICENSE) 协议开源。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifan/pi-commit-zh",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Pi 智能 Git 提交助手(规范化 Conventional Commits 纯中文版,支持一键提审与推流)",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifan/pi-review-zh",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Pi 交互式 AI 代码审查扩展(支持单模型与多 Subagent 并发 2~6 专家自由切换,Codex 经典架构)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,50 @@
1
+ # 🔄 @unifan/pi-workflow-zh (复合工程工作流引擎·中文版)
2
+
3
+ 专为 **Pi Coding Agent** 打造的复合工程工作流(Compound Engineering)引擎扩展。提供状态自动感知、执行断点持久化与长输出智能压缩。
4
+
5
+ ---
6
+
7
+ ## ✨ 核心特性
8
+
9
+ - **工作流状态感知**:自动识别项目当前处于需求、计划、编码还是复盘阶段,提供智能下一步建议。
10
+ - **执行断点恢复(Checkpoints)**:以 Implementation Unit 为粒度持久化执行状态,支持中断后无缝续跑。
11
+ - **产物目录标准化**:自动规范化 `docs/brainstorms/`、`docs/plans/`、`docs/solutions/` 与 `.context/checkpoints/`。
12
+ - **上下文 Token 压缩器**:内置 `bash` 与 `read` 智能过滤器,过滤冗余日志与超大 Lockfile,节省 80%+ Token。
13
+ - **与现代终端问答联动**:无缝协同 `@juicesharp/rpiv-ask-user-question` 终端多选/单选/自由输入组件。
14
+
15
+ ---
16
+
17
+ ## 🚀 安装方式
18
+
19
+ ### 1. 从 npm 在线安装:
20
+ ```bash
21
+ pi install npm:@unifan/pi-workflow-zh
22
+ ```
23
+
24
+ ### 2. 本地路径单独安装:
25
+ ```bash
26
+ pi install D:/program/my/pi-unifan-zh/extensions/workflow
27
+ ```
28
+
29
+ > **提示**:若需要终端弹窗多选复选框等高级问答交互,建议搭配安装:
30
+ > ```bash
31
+ > pi install npm:@juicesharp/rpiv-ask-user-question
32
+ > ```
33
+
34
+ ---
35
+
36
+ ## 🎮 使用方法
37
+
38
+ 在 Pi 中输入命令查看工作流看板:
39
+ ```text
40
+ /workflow
41
+ ```
42
+ 可查看当前项目工作流阶段状态、已归档产物清单与 03-work 自主循环进度。
43
+
44
+ ### 6 大内置复合工程技能
45
+ - **`/skill:00-next`**:智能进度分析与路由推荐
46
+ - **`/skill:01-brainstorm`**:需求发现与边界澄清
47
+ - **`/skill:02-plan`**:TDD 架构规划与 Implementation Units 拆解
48
+ - **`/skill:03-work`** 🚀:**自主循环干活(不做完不停机)**。按计划顺序跨回合自动推进所有单元,完成全部规划前绝不停机,中途可随时输入“暂停”或按 Esc 挂起。
49
+ - **`/skill:04-review`**:全量代码审查与回归验证
50
+ - **`/skill:05-learn`**:极简疑难避坑卡片沉淀