@maxiaochao/pi-toolkit 0.6.0 → 0.7.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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## 2026-09-23 - v0.7.0
2
+
3
+ - bundle the pi-worktree skill documenting the CLI for agents (the isolation loop, and which commands need an interactive terminal); fix pi-worktree: the .gitignore check tested a path form that never matched the directory-only .worktrees/ pattern, so the rule was re-appended on the first run in every repo and that self-inflicted edit then triggered the uncommitted-changes prompt
4
+
5
+ ## 2026-09-22 - v0.6.1
6
+
7
+ - bundle the pdlog skill for decompressing Pudu .pdlog logs (with bundled ppmd binary)
8
+
1
9
  ## 2026-09-22 - v0.6.0
2
10
 
3
11
  - bundle the show-me skill for visual explanations (derived from humanlayer/skills, MIT), invoked explicitly with /skill:show-me
package/README.md CHANGED
@@ -59,6 +59,8 @@ pi-worktree prune # drop stale registrations for manually deleted dirs
59
59
 
60
60
  Typical loop: `pi-worktree start <name>` to start (Tab completes existing worktree names), commit inside Pi, `pi-worktree out` + `git merge <name>` to land the work, `pi-worktree remove <name>` to clean up. New branches are created from the branch you're currently on (or `HEAD` when detached), and the base commit is recorded in `branch.<name>.base` config so `info` can always tell you where the branch came from. Bash completion covers subcommands and existing worktree names (`pi-worktree feat<Tab>`).
61
61
 
62
+ The bundled `pi-worktree` skill documents the CLI for agents: the `start`/`list`/`info`/`out`/`remove`/`prune` commands, the isolation loop from creating a worktree to landing the merge, and which of those commands need an interactive terminal (so an agent uses `start <name> -p "<task>"` for a headless nested run).
63
+
62
64
  The bundled `web-browser` skill provides reusable scripts for starting Chrome/Chromium with remote debugging, navigating tabs, evaluating JavaScript, emulating devices, taking screenshots, dismissing cookie dialogs, and inspecting browser logs. It auto-detects common Chrome/Chromium installations on macOS and Linux, including Windows Chrome when Pi runs under WSL; set `BROWSER_BIN` when the binary is elsewhere.
63
65
 
64
66
  The browser skill can be loaded explicitly with `/skill:web-browser`. Its scripts are available relative to the skill directory, for example:
@@ -81,6 +83,8 @@ Note: Chrome does not always write the `DevToolsActivePort` file (e.g. `--remote
81
83
 
82
84
  The bundled `show-me` skill (derived from [humanlayer/skills](https://github.com/humanlayer/skills), MIT) explains the current topic with the smallest visual that makes the point — pseudocode, call trees, component or file trees, diffs, Mermaid, or one focused HTML artifact. It is hidden from automatic skill selection, so invoke it explicitly with `/skill:show-me`.
83
85
 
86
+ The bundled `pdlog` skill decompresses and reads Pudu `.pdlog` proprietary log files, which are binary gibberish when opened directly. It ships a self-contained `ppmd` decompressor (`skills/pdlog/tools/ppmd`, Linux x86-64) and triggers automatically on `.pdlog` files, Pudu logs, ppmd decompression, or logs that open as binary gibberish.
87
+
84
88
  ## Tiny Subagent
85
89
 
86
90
  The tiny subagent is a separate npm package. Install it independently when you want the `tiny_subagents` tool:
package/bin/pi-worktree CHANGED
@@ -63,7 +63,11 @@ resolve_base() {
63
63
  }
64
64
 
65
65
  ensure_gitignore() {
66
- if ! git check-ignore -q .worktrees 2>/dev/null; then
66
+ # The trailing slash is load-bearing: `.worktrees/` is a directory-only
67
+ # pattern, and git check-ignore cannot match it against a path that does not
68
+ # exist yet — so `.worktrees` would look unignored on every first run and the
69
+ # rule would be appended again.
70
+ if ! git check-ignore -q .worktrees/ 2>/dev/null; then
67
71
  printf '.worktrees/\n' >> .gitignore
68
72
  ok "added .worktrees/ to .gitignore"
69
73
  fi
@@ -233,12 +237,12 @@ cd_wt() {
233
237
  fi
234
238
 
235
239
  local dir; dir="$(wt_dir "$name")"
236
- ensure_gitignore
237
240
 
238
241
  if [[ -d "$dir" ]]; then
239
242
  # Reuse: must be a registered worktree for this repo.
240
243
  # Skip the dirty-workspace prompt — the worktree already exists, nothing new to create.
241
244
  git -C "$dir" rev-parse --git-dir >/dev/null 2>&1 || die "$dir exists but is not a git worktree"
245
+ ensure_gitignore
242
246
  ok "reusing existing worktree $dir"
243
247
  else
244
248
  # Dirty workspace: uncommitted changes do NOT follow into the new worktree.
@@ -249,6 +253,9 @@ cd_wt() {
249
253
  [[ "$ans" =~ ^[Yy]$ ]] || die "aborted"
250
254
  fi
251
255
 
256
+ # After the check above, so the tool's own .gitignore edit is not reported
257
+ # as (and does not prompt about) the user's uncommitted work.
258
+ ensure_gitignore
252
259
  mkdir -p .worktrees
253
260
  # Reuse branch if it exists, else create it
254
261
  if git show-ref --verify --quiet "refs/heads/$name"; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxiaochao/pi-toolkit",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Personal pi coding agent toolkit: /todos, /btw, /cache_export extensions, browser automation, and bundled theme/skills.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: pdlog
3
+ description: 解压和查看 .pdlog 日志文件。触发:.pdlog 文件、普渡日志/Pudu 日志、日志打开是乱码或二进制、ppmd 解压
4
+ ---
5
+
6
+ # pdlog
7
+
8
+ `.pdlog` 是普渡专有压缩日志格式:`cat`/`head`/编辑器直接打开是二进制乱码——这是格式本身,不是文件损坏。先解压成纯文本再读。
9
+
10
+ ## 解压
11
+
12
+ 使用本 skill 目录的 `tools/ppmd`:
13
+
14
+ ```bash
15
+ tools/ppmd -d input.pdlog output.log
16
+ ```
17
+
18
+ - 只想预览不落盘:`tools/ppmd -d input.pdlog /dev/stdout | head -50`
19
+ - 完成判据:`file output.log` 显示 text,`head` 能读到可读行。输出是二进制说明输入不是 pdlog,回到格式分叉。
20
+
21
+ ## 格式分叉
22
+
23
+ - `.gz` 结尾:普通 gzip,用 `zcat`/`gunzip`,不经过 ppmd。
24
+ - 拿不准:先 `file` 看类型。
25
+
26
+ ## 远端文件
27
+
28
+ pdlog 在远端设备或机器上时,先取回本地(`adb pull` / `scp`),解压始终在本地跑。
Binary file
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: pi-worktree
3
+ description: Create, inspect, and clean up git worktrees with the pi-worktree CLI (start/list/info/remove/prune), which also launches Pi inside the worktree. Use when a task warrants isolation in its own worktree, or when the user asks to handle something the worktree way.
4
+ ---
5
+
6
+ # pi-worktree
7
+
8
+ `pi-worktree` wraps git worktree creation and Pi launch into one command. Worktrees live in `.worktrees/<name>` (added to `.gitignore`), each with a branch of the same name, branched from the branch you are on now (or `HEAD` when detached). The base commit is recorded in `branch.<name>.base` / `branch.<name>.baseRef` so `info` can always report where the branch came from.
9
+
10
+ Installed by the package postinstall hook to `~/.local/bin/pi-worktree`, with bash completion for subcommands and existing worktree names.
11
+
12
+ ## Commands
13
+
14
+ | Command | Effect |
15
+ |---|---|
16
+ | `pi-worktree start <name> [pi args...]` | Create or reuse `.worktrees/<name>`, then launch Pi inside it. Already inside a linked worktree, it just launches Pi there. |
17
+ | `pi-worktree start --base <ref> <name> [pi args...]` | Same, but branch from `<ref>` instead of the current branch. |
18
+ | `pi-worktree list` | All worktrees; the main checkout is marked `(main checkout)`, stale registrations are flagged. |
19
+ | `pi-worktree info <name>` | Clean/dirty status, branch and HEAD, base commit, ahead/behind `main`, unique commits. |
20
+ | `pi-worktree out` | Open a shell in the main checkout (for merging). |
21
+ | `pi-worktree remove <name>` | Remove the worktree and its branch; asks before discarding dirty files or unmerged commits. |
22
+ | `pi-worktree prune` | Drop registrations whose directory was deleted by hand. |
23
+
24
+ ## Isolating a task
25
+
26
+ 1. **Survey** — `pi-worktree list`, plus `pi-worktree info <name>` when the name you want is already taken. Reuse is free; a removed worktree is gone for good, because `remove` deletes its branch.
27
+ 2. **Start** — `pi-worktree start <name>` (with `--base <ref>` when the work must not start from the current branch). Done when `list` shows the new worktree on its own branch.
28
+ 3. **Work** — inside the worktree: commit there, and check `pi-worktree info <name>` before claiming progress. `ahead: N commits since base` is the evidence.
29
+ 4. **Land** — `pi-worktree out`, then `git merge <name>` in the main checkout. Done when the worktree's unique commits are in the target branch.
30
+ 5. **Clean up** — `pi-worktree remove <name>`. A merged branch goes without prompting; anything unmerged asks once.
31
+
32
+ ## Driving it from an agent
33
+
34
+ - `start` **execs `pi`** in the worktree, and `out` execs a shell. With no trailing Pi args both want an interactive terminal, so either run `start <name> -p "<task>"` for a headless nested run, or hand the bare `start <name>` to the user to run themselves.
35
+ - `remove` asks before discarding dirty files or unmerged commits, and a non-interactive stdin (EOF) aborts safely. Answer explicitly when the removal is intended: `printf 'y\ny\n' | pi-worktree remove <name>`.
36
+ - Your own working directory cannot change. "Isolate this in a worktree" therefore means launching a nested headless Pi in the worktree, or telling the user to run `pi-worktree start <name>`.