66 lines
2.3 KiB
Markdown
66 lines
2.3 KiB
Markdown
# 安装 pouch
|
||
|
||
用户说「帮我安装 pouch」「把 skill 装上」,或丢来仓库 URL / 本地路径时执行。
|
||
本文件是代装步骤的唯一详细来源。不要用 `pouch select`(必须交互式 TTY)。
|
||
不要在未确认时覆盖已有的 `~/.pouch`。CLI 只认 `~/.pouch`。
|
||
|
||
默认 remote:`https://git.yumee.top/laily/pouch.git`。用户给了 URL 或本地路径则用用户的。
|
||
|
||
## 1. 确认本机
|
||
|
||
需要 `python3` 和 `git`。缺了先说明怎么装,不要继续。
|
||
|
||
## 2. 让 `~/.pouch` 指向本仓库
|
||
|
||
按现状只走一条:
|
||
|
||
| 现状 | 动作 |
|
||
| --- | --- |
|
||
| 当前目录就是这份仓库(有 `install.sh` 和 `skills/`),且没有 `~/.pouch` | `ln -sfn "$(pwd)" "$HOME/.pouch"` |
|
||
| `~/.pouch` 已在且含 `skills/`、`install.sh` | 沿用 |
|
||
| 只有 `~/.skills` | `mv ~/.skills ~/.pouch` |
|
||
| 都没有 | `git clone <URL> ~/.pouch`。失败则问用户本地路径或可用 remote |
|
||
| `~/.pouch` 在,但不是这份仓库 | 停下问用户,不要删、不要覆盖 |
|
||
|
||
clone 私有 Git 失败时停下来问路径或认证,不要改 remote、不要改用交互式 `pouch select`。
|
||
|
||
## 3. 装 CLI 和 `pouch` skill
|
||
|
||
```bash
|
||
"$HOME/.pouch/install.sh"
|
||
export PATH="$HOME/.local/bin:$PATH"
|
||
command -v pouch
|
||
pouch status
|
||
```
|
||
|
||
`install.sh` 会改 rc,当前会话仍要 `export PATH`。不要让用户重开终端才继续。
|
||
它只全局安装 **pouch** 这一个 skill。其它 skill 不要默认全装。
|
||
|
||
## 4. 介绍 builtin skill,再问要装哪些
|
||
|
||
```bash
|
||
python3 "$HOME/.pouch/skills/pouch/scripts/catalog.py"
|
||
```
|
||
|
||
把表格里的「做什么」和「可以这么说」告诉用户。不要念 frontmatter `description`,
|
||
不要通读各 README。用户没点名就问一次:装哪些、全局还是当前项目。能判断就不要追问。
|
||
|
||
```bash
|
||
pouch add <name> -g -y # 全局,所有项目都能用
|
||
pouch add <name> -y # 仅当前项目
|
||
```
|
||
|
||
默认 `pouch add` 装到当前工作目录。cwd 是 pouch 仓库本身时用 `-g`,除非用户就在维护 pouch。
|
||
用户是在自己的应用仓库里请你代装,才做项目级安装。
|
||
|
||
## 5. 验收
|
||
|
||
```bash
|
||
pouch status
|
||
pouch doctor
|
||
```
|
||
|
||
软链异常则 `pouch doctor --fix`。已经装好时只汇报状态,问还要不要加 skill,不要重新 clone。
|
||
|
||
当前目录是业务仓库(不是 pouch 仓库)时,回到 SKILL.md,走「接入当前项目」。
|