setup-pi

Installation
SKILL.md

为当前机器配置 piw(新建分支和 worktree 后直接进入 pi)与 piw-clean(移除 worktree、prune、删除分支并回到主仓库)两个命令。种子模板按用户实际使用的 shell 二选一:POSIX shell 用 references/piw-commands.md,Windows PowerShell 用 references/piw-commands-windows.md。只写取得用户确认的文件。

1. 探索

读取,不要假设:

  • 判断平台:uname -s 为 Windows_NT / MINGW* / MSYS* / CYGWIN*,或 $env:OS 为 Windows_NT,都算 Windows。
  • Windows 上先确定用户从哪个 shell 用 pi:PowerShell 还是 git-bash / MSYS。Windows PowerShell 5.1 与 PowerShell 7 的 $PROFILE 是两个文件,也要先确认版本。
  • 交互 shell 中 type piw piw-clean(bash / zsh)或 Get-Command piw,piw-clean(PowerShell)是否已定义。目标文件里是否已有同名函数及其行号范围。
  • 用户实际使用的 shell 及目标文件(bash ~/.bashrc,zsh ~/.zshrc,PowerShell $PROFILE)。
  • 已有函数与模板的差异:旧版本用 git branch -d 删分支,squash 合并的分支会误报“未合并”而删不掉。
  • Windows 上定位 Windows Terminal 的 settings.json:Store 版 $env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json,解包版 $env:LOCALAPPDATA\Microsoft\Windows Terminal\settings.json,取先存在者。
  • $PROFILE 是否已有 cwd 跟踪段(搜 ]9;9;)、prompt 初始化(如 starship init)所在行。settings.json 的 actions 里是否已绑 duplicateTab 或 ctrl+shift+t。

2. 决策

说明两个命令的行为,向用户确认写入哪个文件:

Installs
46
GitHub Stars
5
First Seen
Aug 13, 2026