pi-session-peek 0.2.1 → 0.3.1

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - `scanSessions` is now async: directory walking and file reads go through `fs/promises` with bounded concurrency, so opening `/peek` with hundreds of sessions no longer blocks the TUI.
6
+ - Sessions no longer keep a second, lowercased copy of their full text for searching. Keyword filtering runs case-insensitive regexes over the messages directly, which roughly halves memory per cached session and is faster than the old `toLowerCase().includes()` scan.
7
+
8
+ ## 0.3.0
9
+
10
+ - Ctrl+D now prefers the system trash on every platform instead of only the `trash` CLI: Windows Recycle Bin via PowerShell, Finder on macOS, `gio trash` / `trash-put` on Linux. The file is deleted permanently only when none of them works, and the notification says which one happened.
11
+
3
12
  ## 0.2.1
4
13
 
5
14
  - Ctrl+N / Ctrl+P now jump between hit lines instead of hit messages. Several hits inside one long reply used to collapse into a single stop, so the preview appeared not to move. Hits already on screen are skipped, and the top-right corner shows the current hit as `hit k/n`.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Jeffropz
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jeffropz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -68,7 +68,7 @@ In TUI mode, run `/peek` and start typing. Press `Enter` on a session to continu
68
68
  | `Enter` | Resume the session |
69
69
  | `Ctrl+O` | Fork the session and open the fork |
70
70
  | `Ctrl+R` | Rename. Writes the same `session_info` entry as `/name`. |
71
- | `Ctrl+D` | Delete, confirmed with `y` or `Enter`. Uses the `trash` CLI when available, otherwise deletes the file. |
71
+ | `Ctrl+D` | Delete, confirmed with `y` or `Enter`. Moves the file to the system trash whenever one is available (`trash` CLI, then the Windows Recycle Bin via PowerShell, Finder on macOS, `gio trash` / `trash-put` on Linux). Deletes permanently only if none of those work. |
72
72
  | `Esc` `Ctrl+C` | Close |
73
73
 
74
74
  ## 🔎 Search syntax
@@ -130,6 +130,22 @@ npm run screenshot # optional: overwrite docs/screenshot.png with a syntheti
130
130
 
131
131
  To load a local checkout, add its path under `extensions` in `~/.pi/agent/settings.json` or drop the folder into `~/.pi/agent/extensions/`, then `/reload`.
132
132
 
133
+ ### Releasing
134
+
135
+ Every push to `main` and every pull request runs `npm run check` on Ubuntu and Windows (`.github/workflows/ci.yml`). Pushing a `vX.Y.Z` tag runs `.github/workflows/release.yml`, which checks that the tag matches `package.json`, runs the checks again, publishes to npm through [trusted publishing](https://docs.npmjs.com/trusted-publishers/) (no token needed, provenance attached automatically) and creates a GitHub Release from the matching `CHANGELOG.md` section.
136
+
137
+ One-time setup on npmjs.com: package settings → Trusted Publisher → GitHub Actions, with owner `Jeffropz`, repository `pi-session-peek`, workflow filename `release.yml`.
138
+
139
+ To cut a release:
140
+
141
+ ```bash
142
+ # 1. move the "## Unreleased" entries in CHANGELOG.md under the new version and commit
143
+ # 2. bump the version, commit and tag in one go (patch / minor / major)
144
+ npm version patch -m "chore: release %s"
145
+ # 3. push the commit together with the tag; CI does the rest
146
+ git push --follow-tags
147
+ ```
148
+
133
149
  ## 📄 License
134
150
 
135
151
  MIT. See [`LICENSE`](./LICENSE).
package/README.zh-CN.md CHANGED
@@ -68,7 +68,7 @@ pi 扩展以你的用户权限运行,只装信得过的包。
68
68
  | `Enter` | 进入会话 |
69
69
  | `Ctrl+O` | 分叉出新会话并进入 |
70
70
  | `Ctrl+R` | 重命名,写入的记录和 `/name` 一样 |
71
- | `Ctrl+D` | 删除,按 `y` 或 `Enter` 确认。有 `trash` 命令就进回收站,否则直接删文件。 |
71
+ | `Ctrl+D` | 删除,按 `y` 或 `Enter` 确认。只要系统有回收站就优先进回收站(`trash` 命令、Windows 用 PowerShell 进回收站、macOS 用 Finder、Linux 用 `gio trash` / `trash-put`),全都不可用才直接删文件。 |
72
72
  | `Esc` `Ctrl+C` | 关闭 |
73
73
 
74
74
  ## 🔎 搜索语法
@@ -130,6 +130,22 @@ npm run screenshot # 可选:用合成渲染覆盖 docs/screenshot.png,
130
130
 
131
131
  本地开发时把目录路径加到 `~/.pi/agent/settings.json` 的 `extensions` 里,或者直接放进 `~/.pi/agent/extensions/`,然后 `/reload`。
132
132
 
133
+ ### 发版
134
+
135
+ 推到 `main` 和提 PR 都会在 Ubuntu 和 Windows 上跑 `npm run check`(`.github/workflows/ci.yml`)。推一个 `vX.Y.Z` 的 tag 会触发 `.github/workflows/release.yml`:校验 tag 和 `package.json` 版本一致,再跑一遍检查,通过 [trusted publishing](https://docs.npmjs.com/trusted-publishers/) 发到 npm(不需要 token,自动附带 provenance),最后从 `CHANGELOG.md` 里对应版本的段落生成 GitHub Release。
136
+
137
+ npm 侧需要一次性配置:包设置 → Trusted Publisher → GitHub Actions,填 owner `Jeffropz`、repository `pi-session-peek`、workflow filename `release.yml`。
138
+
139
+ 发一个版本:
140
+
141
+ ```bash
142
+ # 1. 把 CHANGELOG.md 里 "## Unreleased" 下的条目挪到新版本号下面,提交
143
+ # 2. 升版本号、提交、打 tag 一步完成(patch / minor / major)
144
+ npm version patch -m "chore: release %s"
145
+ # 3. 提交和 tag 一起推上去,剩下的交给 CI
146
+ git push --follow-tags
147
+ ```
148
+
133
149
  ## 📄 许可证
134
150
 
135
151
  MIT,见 [`LICENSE`](./LICENSE)。
package/index.ts CHANGED
@@ -54,7 +54,7 @@ export default function (pi: ExtensionAPI) {
54
54
 
55
55
  // 当前正在用的会话不列出来
56
56
  const currentFile = ctx.sessionManager.getSessionFile();
57
- const all = scanSessions().filter((s) => s.path !== currentFile);
57
+ const all = (await scanSessions()).filter((s) => s.path !== currentFile);
58
58
  if (!all.length) {
59
59
  ctx.ui.notify(msg("noSessions"), "info");
60
60
  return;
@@ -78,9 +78,13 @@ export default function (pi: ExtensionAPI) {
78
78
  done(null);
79
79
  };
80
80
  comp.onDelete = async (s) => {
81
- const ok = await deleteSession(s.path, (cmd, a) => pi.exec(cmd, a, { timeout: 4000 }));
82
- ctx.ui.notify(ok ? msg("deleted", { file: basename(s.path) }) : msg("deleteFailed"), ok ? "info" : "error");
83
- return ok;
81
+ // PowerShell / osascript 冷启动要一两秒,超时给宽一点
82
+ const r = await deleteSession(s.path, (cmd, a) => pi.exec(cmd, a, { timeout: 15000 }));
83
+ const file = basename(s.path);
84
+ if (r === "trash") ctx.ui.notify(msg("trashed", { file }), "info");
85
+ else if (r === "rm") ctx.ui.notify(msg("deleted", { file }), "info");
86
+ else ctx.ui.notify(msg("deleteFailed"), "error");
87
+ return r !== false;
84
88
  };
85
89
  comp.onRename = async (s, name) => {
86
90
  let ok = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-session-peek",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Pi extension: search session history in a two-pane picker with full conversation preview, then resume or fork.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/i18n.ts CHANGED
@@ -6,7 +6,8 @@ const zh = {
6
6
  cmdDesc: "搜索历史会话:左右分栏预览、关键词高亮,Enter 进入对话",
7
7
  needTui: "/peek 需要在交互模式(TUI)下使用",
8
8
  noSessions: "没有找到历史会话",
9
- deleted: "已删除会话 {file}",
9
+ trashed: "已将会话 {file} 移入回收站",
10
+ deleted: "已永久删除会话 {file}(未找到回收站)",
10
11
  deleteFailed: "删除会话失败",
11
12
  renamed: "已重命名为「{name}」",
12
13
  renameFailed: "重命名失败",
@@ -45,7 +46,8 @@ const en: Record<keyof typeof zh, string> = {
45
46
  cmdDesc: "Search session history: two-pane preview with keyword highlighting, Enter to resume",
46
47
  needTui: "/peek only works in interactive (TUI) mode",
47
48
  noSessions: "No sessions found",
48
- deleted: "Deleted session {file}",
49
+ trashed: "Moved session {file} to the trash",
50
+ deleted: "Permanently deleted session {file} (no trash available)",
49
51
  deleteFailed: "Failed to delete session",
50
52
  renamed: "Renamed to “{name}”",
51
53
  renameFailed: "Rename failed",