refactor: split pi-generic config into pi-toolkit repo
Parallel to the opencode-toolkit split earlier today. Pi's own config (keybindings, shell env loader, settings template) moves to a new sibling repo so opencode-devbox's mempalace opt-out can build slim containers that include pi without dragging in chromadb + embedding models (~300 MB). What moved to pi-toolkit (https://gitea.jordbo.se/joakimp/pi-toolkit): - extensions/pi/keybindings.json (mosh/tmux newline fix) - extensions/pi/pi-env.zsh (sources ~/.config/pi/.env) - extensions/pi/settings.example.json (Bedrock template) - install.sh::install_pi_keybindings (symlink step) - install.sh::install_pi_env_loader (cp step + bash fallback) - install.sh::check_pi_settings (probe) - install.sh::check_aws_env (probe) What stays here (this is the pi\u2194mempalace bridge, mempalace-side): - extensions/pi/mempalace.ts (the MCP extension) - install.sh::install_pi_extension (symlink step) - NEW: install.sh::check_pi_toolkit (probe: warns if pi is installed but pi-toolkit's artifacts are missing, with git-clone pointer) install.sh shrank from 520 to 403 lines. Uninstall mirror correctly does NOT touch pi-toolkit-owned files (explicit comment). Docs updated: - extensions/pi/README.md: rewritten as 'pi\u2194MemPalace MCP bridge', recipe becomes 'Deploying pi with mempalace' (pi-toolkit step 3, this repo step 5). - AGENTS.md: Structure block + 'What install.sh does' section reflect the narrower scope and list the four things that moved out. - README.md: repo-contents line + Setup section's deploy summary. Verified on tor-ms22: full install\u2192uninstall\u2192reinstall lifecycle clean. After mempalace-toolkit uninstall, pi-toolkit artifacts (~/.pi/agent/keybindings.json, ~/.oh-my-zsh/custom/pi-env.zsh) remain intact \u2014 correctly untouched. check_pi_toolkit probe fires green when both exist.
This commit is contained in:
@@ -19,12 +19,9 @@ bin/
|
||||
mempalace-pi-session # pi session → MemPalace bridge (bash + inline Python)
|
||||
contrib/ # systemd / launchd / cron templates for scheduling feeders
|
||||
extensions/
|
||||
pi/ # pi coding-agent bring-up: MCP bridge, keybindings, settings template
|
||||
pi/ # pi↔mempalace MCP bridge (bridge-only; pi's own config is in the pi-toolkit repo)
|
||||
mempalace.ts # Symlinked into ~/.pi/agent/extensions/ (MCP <→ pi glue)
|
||||
keybindings.json # Symlinked into ~/.pi/agent/ (mosh/tmux newline fix)
|
||||
pi-env.zsh # Copied into ~/.oh-my-zsh/custom/ or sourced from .bashrc (loads ~/.config/pi/.env)
|
||||
settings.example.json # Template; user copies + edits (pi rewrites settings.json at runtime)
|
||||
README.md # Extension internals, schema-passthrough gotcha, env setup
|
||||
README.md # Bridge internals, Type.Unsafe gotcha, pi+mempalace deploy recipe
|
||||
```
|
||||
|
||||
## What `install.sh` does
|
||||
@@ -37,19 +34,25 @@ Idempotent, safe to re-run. Always:
|
||||
Gated on pi being installed (`~/.pi/agent/extensions/` exists):
|
||||
|
||||
- Symlinks `extensions/pi/mempalace.ts` into `~/.pi/agent/extensions/`. Backs up any real file in the way.
|
||||
- Symlinks `extensions/pi/keybindings.json` into `~/.pi/agent/`. Backs up any real file in the way.
|
||||
- `settings.example.json` is **not** symlinked — pi rewrites `settings.json` at runtime, so we'd dirty the repo. Installer warns if `settings.json` is missing and prints the `cp` command.
|
||||
|
||||
Probes (never halt, `warn` + `return 0`):
|
||||
|
||||
- `~/.local/bin` is on `$PATH`.
|
||||
- `~/.config/opencode/instructions/mempalace.md` exists (opencode wake-up protocol).
|
||||
- `mempalace` is registered as an MCP server in `~/.config/opencode/opencode.json`.
|
||||
- `~/.pi/agent/settings.json` exists (if pi is installed).
|
||||
- `AWS_PROFILE`/`AWS_REGION` set, but only if `settings.json` exists *and* selects `amazon-bedrock`. Silent otherwise.
|
||||
- If pi is installed: pi-toolkit artifacts (`~/.pi/agent/keybindings.json` symlink, `~/.oh-my-zsh/custom/pi-env.zsh`) exist. Warns with a `git clone ssh://...pi-toolkit.git` pointer if missing.
|
||||
|
||||
All non-destructive: if something is already in place and points into this repo, prints "already linked" and moves on. If a non-symlink real file is in the way, backs it up with a timestamp.
|
||||
|
||||
**Not handled here any more** (split to [`pi-toolkit`](https://gitea.jordbo.se/joakimp/pi-toolkit) on 2026-05-05):
|
||||
|
||||
- `keybindings.json` symlink into `~/.pi/agent/`
|
||||
- `pi-env.zsh` cp into `~/.oh-my-zsh/custom/`
|
||||
- `settings.example.json` template + `check_pi_settings` probe
|
||||
- `check_aws_env` probe
|
||||
|
||||
Those are pi-generic concerns. This toolkit installs **only** the pi↔mempalace MCP bridge on top of whatever pi-toolkit set up.
|
||||
|
||||
|
||||
## Conventions
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Producer-side tooling for [MemPalace](https://github.com/MemPalace/mempalace)
|
||||
- `bin/mempalace-docs` — mines project directories into MemPalace while excluding source code, keeping the palace signal-dense.
|
||||
- [`ARCHITECTURE.md`](ARCHITECTURE.md) — **canonical spec**: architecture diagram, component details, setup recipe, operational notes, upstream-retirement roadmap.
|
||||
- [`SKILL.md`](SKILL.md) — the companion agent skill, symlinked into `~/.agents/skills/opencode-mempalace-bridge/` on install.
|
||||
- [`extensions/pi/`](extensions/pi/) — pi coding-agent bridge: the MemPalace MCP extension (symlinked), a mosh/tmux-friendly keybindings file (symlinked), a `pi-env.zsh` shell loader (copied into `~/.oh-my-zsh/custom/` on zsh+omz hosts, or source'd from `.bashrc` / `.zshrc` otherwise), and a `settings.example.json` template for starting pi without `--model`. `install.sh` also probes for `AWS_PROFILE`/`AWS_REGION` (needed by pi's Bedrock provider) and points at the recommended `~/.config/pi/.env` layout if missing.
|
||||
- [`extensions/pi/`](extensions/pi/) — the pi↔mempalace MCP bridge (a TypeScript extension symlinked into `~/.pi/agent/extensions/`). Pi's own base config (keybindings, env loader, settings template) is in the sibling [`pi-toolkit`](https://gitea.jordbo.se/joakimp/pi-toolkit) repo — split out 2026-05-05 so `opencode-devbox` can build slim containers without mempalace.
|
||||
|
||||
**If you're just trying to get this working on a new machine → jump to [Setup](#setup).**
|
||||
**If you want the full architecture story → read [`ARCHITECTURE.md`](ARCHITECTURE.md).**
|
||||
@@ -234,25 +234,25 @@ export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
### Deploying pi on a new machine (full recipe)
|
||||
|
||||
If the target machine also runs [pi](https://github.com/mariozechner/pi-coding-agent), there's a longer multi-step recipe covering dotfiles provisioning (tmux CSI-u keys, `~/.config/pi/.env`, zsh loader), mempalace install, pi settings bootstrap (starting pi without `--model`), and the AWS env verification. It lives in **[`extensions/pi/README.md` § Deploying pi on a new machine](extensions/pi/README.md#deploying-pi-on-a-new-machine)** so the step-by-step stays next to the files it installs.
|
||||
If the target machine also runs [pi](https://github.com/mariozechner/pi-coding-agent), the recipe is: install [`pi-toolkit`](https://gitea.jordbo.se/joakimp/pi-toolkit) first (pi's own base config), then this toolkit (adds the pi↔mempalace MCP bridge). Full step-by-step: **[`extensions/pi/README.md` § Deploying pi with mempalace on a new machine](extensions/pi/README.md#deploying-pi-with-mempalace-on-a-new-machine)**.
|
||||
|
||||
Quick summary:
|
||||
|
||||
```bash
|
||||
# 1. Dotfiles (tmux extended-keys, ~/.config/pi/.env, pi-env.zsh)
|
||||
# 1. Dotfiles (tmux extended-keys, ~/.config/pi/.env, ...)
|
||||
git clone <myconfigs> && cd myconfigs && ./provision.sh --profile <profile>
|
||||
|
||||
# 2. pi (upstream) 3. mempalace CLI
|
||||
brew install pi-coding-agent uv tool install mempalace
|
||||
# 2. pi upstream 3. pi-toolkit (pi base config)
|
||||
brew install pi-coding-agent git clone ssh://git@gitea.jordbo.se:2222/joakimp/pi-toolkit.git
|
||||
cd pi-toolkit && ./install.sh
|
||||
|
||||
# 4. This repo's install.sh
|
||||
cd ~/mempalace-toolkit && ./install.sh
|
||||
# 4. settings bootstrap
|
||||
cp ~/pi-toolkit/settings.example.json ~/.pi/agent/settings.json && $EDITOR !$
|
||||
|
||||
# 5. pi settings (one-time bootstrap, region-specific)
|
||||
cp extensions/pi/settings.example.json ~/.pi/agent/settings.json
|
||||
$EDITOR ~/.pi/agent/settings.json # adjust eu./us./anthropic: prefix
|
||||
# 5. mempalace CLI 6. This repo (adds the bridge)
|
||||
uv tool install mempalace cd ~/mempalace-toolkit && ./install.sh
|
||||
|
||||
# 6. Open fresh shell, run `pi`. Wake-up auto-injection proves end-to-end.
|
||||
# 7. Open fresh shell, run `pi`. Wake-up auto-injection proves end-to-end.
|
||||
```
|
||||
|
||||
### First mine
|
||||
|
||||
+112
-216
@@ -1,163 +1,23 @@
|
||||
# pi ↔ MemPalace extension
|
||||
# pi ↔ MemPalace MCP bridge
|
||||
|
||||
The canonical source of `~/.pi/agent/extensions/mempalace.ts` — the bridge
|
||||
that wires the [MemPalace](https://github.com/MemPalace/mempalace) MCP
|
||||
The canonical source of `~/.pi/agent/extensions/mempalace.ts` — the TypeScript
|
||||
extension that wires [MemPalace](https://github.com/MemPalace/mempalace)'s MCP
|
||||
server into the [pi coding-agent](https://github.com/mariozechner/pi-coding-agent)
|
||||
harness.
|
||||
harness. Installs wake-up context injection, per-tool schema passthrough,
|
||||
and a `/mempalace-diary` slash-command.
|
||||
|
||||
`install.sh` at the repo root symlinks `mempalace.ts` from this directory
|
||||
into `~/.pi/agent/extensions/` so the live file on every machine tracks
|
||||
version control. Works on macOS and Linux (the extension itself is plain
|
||||
Node / TypeScript; the symlink is a POSIX `ln -s`).
|
||||
This directory **only** holds the bridge. Pi's own base config (keybindings,
|
||||
environment loader, settings template) lives in the sibling
|
||||
[`pi-toolkit`](https://gitea.jordbo.se/joakimp/pi-toolkit) repo — split out
|
||||
2026-05-05 so [`opencode-devbox`](https://gitea.jordbo.se/joakimp/opencode-devbox)
|
||||
can build slim containers that include pi without dragging in mempalace's
|
||||
dependencies (~300 MB).
|
||||
|
||||
**Jump to:**
|
||||
- [Deploying pi on a new machine](#deploying-pi-on-a-new-machine) — step-by-step recipe.
|
||||
- [Keybindings (mosh/tmux newline fix)](#keybindings-moshtmux-newline-fix)
|
||||
- [Settings template](#settings-template-start-pi-without---model)
|
||||
- [Environment setup](#environment-setup)
|
||||
|
||||
---
|
||||
|
||||
## Deploying pi on a new machine
|
||||
|
||||
Full recipe from a clean macOS or Linux box to a working pi+MemPalace
|
||||
install with all modifications shipped by this repo and by
|
||||
[`myconfigs`](https://gitea.jordbo.se/joakimp/myconfigs). Follow in order.
|
||||
|
||||
### 0. Prerequisites
|
||||
|
||||
- Shell: **zsh + oh-my-zsh** (the env loader is `~/.oh-my-zsh/custom/pi-env.zsh`).
|
||||
On bash-only hosts, adapt by sourcing `~/.config/pi/.env` from `~/.bashrc`.
|
||||
- `git`, `node` ≥ 20, `uv` (for installing mempalace), `tmux` ≥ 3.2.
|
||||
- AWS credentials reachable via `AWS_PROFILE` (either `aws configure sso`
|
||||
cache or static keys in `~/.aws/credentials`) — **only if** you'll use
|
||||
`amazon-bedrock` as pi's provider.
|
||||
|
||||
### 1. Clone your dotfiles repo and provision
|
||||
|
||||
Brings `~/.tmux.conf` with CSI-u extended keys, `~/.config/pi/.env`
|
||||
(git-crypt encrypted), and `~/.oh-my-zsh/custom/pi-env.zsh`:
|
||||
|
||||
```bash
|
||||
git clone ssh://git@gitea.jordbo.se:2222/joakimp/myconfigs.git ~/src/src_local/myconfigs
|
||||
cd ~/src/src_local/myconfigs
|
||||
|
||||
# Unlock git-crypt so ~/.config/pi/.env decrypts (skip on a box that has
|
||||
# never held your git-crypt key; see myconfigs/GIT-CRYPT.md to set up).
|
||||
git-crypt unlock ~/path/to/git-crypt-key
|
||||
|
||||
# Provision — choose the profile matching the box (homelab, work-macos, ...).
|
||||
./provision.sh --dry-run --profile homelab # preview
|
||||
./provision.sh --profile homelab # apply
|
||||
```
|
||||
|
||||
### 2. Install pi (upstream)
|
||||
|
||||
```bash
|
||||
brew install pi-coding-agent # macOS
|
||||
# or: follow https://github.com/mariozechner/pi-coding-agent for Linux
|
||||
```
|
||||
|
||||
First run creates `~/.pi/agent/`.
|
||||
|
||||
### 3. Install mempalace + the toolkit
|
||||
|
||||
```bash
|
||||
# MemPalace CLI (isolated venv via uv, shim in ~/.local/bin)
|
||||
uv tool install mempalace
|
||||
|
||||
# mempalace-toolkit (this repo) — the bin/ wrappers, the pi extension,
|
||||
# keybindings, settings template, and install probes.
|
||||
git clone ssh://git@gitea.jordbo.se:2222/joakimp/mempalace-toolkit.git ~/mempalace-toolkit
|
||||
cd ~/mempalace-toolkit
|
||||
./install.sh
|
||||
```
|
||||
|
||||
`install.sh` detects pi, symlinks `mempalace.ts` + `keybindings.json` into
|
||||
`~/.pi/agent/`, installs the companion skill, and runs five probes. The
|
||||
AWS probe stays quiet until step 4 selects `amazon-bedrock`.
|
||||
|
||||
### 4. Bootstrap pi settings (start pi without `--model`)
|
||||
|
||||
```bash
|
||||
cp ~/mempalace-toolkit/extensions/pi/settings.example.json \
|
||||
~/.pi/agent/settings.json
|
||||
$EDITOR ~/.pi/agent/settings.json
|
||||
```
|
||||
|
||||
Adjust the inference-profile prefix to match your AWS region:
|
||||
|
||||
| Region | Prefix | Example model ID |
|
||||
|---|---|---|
|
||||
| eu-west-1 | `eu.` | `eu.anthropic.claude-sonnet-4-6` |
|
||||
| us-east-1 | `us.` | `us.anthropic.claude-sonnet-4-6` |
|
||||
| non-Bedrock | (none) | `anthropic:claude-sonnet-4-6` |
|
||||
|
||||
Run `pi --list-models` to confirm what your credentials can actually invoke.
|
||||
|
||||
### 5. Ensure AWS env vars are live in your shell
|
||||
|
||||
**On zsh + oh-my-zsh hosts:** step 3's `install.sh` already copied
|
||||
`pi-env.zsh` into `~/.oh-my-zsh/custom/`, so every new shell sources
|
||||
`~/.config/pi/.env` automatically. Verify:
|
||||
|
||||
```bash
|
||||
exec zsh
|
||||
echo "$AWS_PROFILE $AWS_REGION" # should print your values
|
||||
```
|
||||
|
||||
**On bash or plain zsh (no oh-my-zsh):** `install.sh` printed a
|
||||
`source <repo>/extensions/pi/pi-env.zsh` snippet — add that one line to
|
||||
`~/.bashrc` or `~/.zshrc`, open a fresh shell, verify as above.
|
||||
|
||||
If vars are empty, check that `~/.config/pi/.env` decrypted
|
||||
(`head ~/.config/pi/.env` should show plain text, not binary).
|
||||
`git-crypt unlock` in step 1 is the usual culprit when this is empty.
|
||||
|
||||
### 6. Register mempalace MCP with opencode (if using opencode too)
|
||||
|
||||
Skip if this box is pi-only. Otherwise:
|
||||
|
||||
- Install [`opencode-toolkit`](https://gitea.jordbo.se/joakimp/opencode-toolkit) so `~/.config/opencode/.env` is sourced into every shell (GitHub / Gitea / other MCP server tokens).
|
||||
- Register the mempalace MCP server in `~/.config/opencode/opencode.json` — see [root README § Registering mempalace with opencode](../../README.md#registering-mempalace-with-opencode-or-other-mcp-clients).
|
||||
|
||||
### 7. First run
|
||||
|
||||
```bash
|
||||
pi # should start with the default model, no --model needed
|
||||
```
|
||||
|
||||
Inside pi, the wake-up auto-injection should print a `mempalace-wakeup`
|
||||
system message with palace status and recent diary entries. If it doesn't,
|
||||
run `MEMPALACE_EXT_DEBUG=1 pi` to surface `mempalace-mcp` stderr.
|
||||
|
||||
### Verification checklist
|
||||
|
||||
```bash
|
||||
# Symlinks in place
|
||||
ls -la ~/.pi/agent/mempalace.ts ~/.pi/agent/keybindings.json # → repo
|
||||
ls -la ~/.agents/skills/opencode-mempalace-bridge/SKILL.md # → repo
|
||||
|
||||
# Env loaded
|
||||
zsh -ic 'echo $AWS_PROFILE $AWS_REGION'
|
||||
|
||||
# tmux extended keys
|
||||
tmux show-options -g | grep extended-keys # csi-u
|
||||
|
||||
# Palace reachable
|
||||
mempalace status
|
||||
|
||||
# Installer re-run is idempotent
|
||||
cd ~/mempalace-toolkit && ./install.sh --yes # all rows should say "already linked"
|
||||
```
|
||||
|
||||
### Uninstall
|
||||
|
||||
```bash
|
||||
cd ~/mempalace-toolkit && ./install.sh --uninstall --yes
|
||||
# Leaves mempalace CLI, pi binary, and ~/.config/pi/.env alone —
|
||||
# only removes symlinks this repo created.
|
||||
```
|
||||
- [What it does](#what-it-does)
|
||||
- [The `Type.Unsafe` gotcha](#the-typeunsafe-gotcha)
|
||||
- [Deploying pi with mempalace on a new machine](#deploying-pi-with-mempalace-on-a-new-machine)
|
||||
- [Fail-soft, identity, debugging](#fail-soft)
|
||||
|
||||
---
|
||||
|
||||
@@ -222,74 +82,113 @@ If you ever need to re-loosen the schema for debugging, fall back to
|
||||
the `Type.Object({}, { additionalProperties: true })` default only for
|
||||
that specific tool, not globally.
|
||||
|
||||
## Keybindings (mosh/tmux newline fix)
|
||||
---
|
||||
|
||||
`keybindings.json` is symlinked so edits flow through git. Default:
|
||||
## Deploying pi with mempalace on a new machine
|
||||
|
||||
```json
|
||||
{
|
||||
"tui.input.newLine": ["shift+enter", "ctrl+j", "alt+j"]
|
||||
}
|
||||
```
|
||||
This is the "pi + memory" recipe. For pi without mempalace, see
|
||||
[`pi-toolkit`'s README](https://gitea.jordbo.se/joakimp/pi-toolkit/src/branch/main/README.md#deploying-pi-on-a-new-machine).
|
||||
|
||||
Rationale: when pi runs over `kitty → mosh → tmux`, shift+enter doesn't
|
||||
forward cleanly (mosh uses vt220-ish emulation, no kitty-keyboard-protocol
|
||||
or csi-u extended keys). `ctrl+j` and `alt+j` pass through as plain
|
||||
control/meta bytes and give you reliable newline insertion.
|
||||
### 0. Prerequisites
|
||||
|
||||
## Settings template (start pi without `--model`)
|
||||
- Shell: zsh + oh-my-zsh recommended (both toolkits install loaders into
|
||||
`~/.oh-my-zsh/custom/`; bash works too, installers print the manual
|
||||
`source` snippet).
|
||||
- `git`, `node` ≥ 20, `uv`, `tmux` ≥ 3.2, pi installed upstream.
|
||||
- AWS credentials reachable via `AWS_PROFILE` — only if using
|
||||
`amazon-bedrock` as pi's provider.
|
||||
|
||||
`settings.example.json` is a template — **not symlinked**. pi rewrites
|
||||
its `settings.json` at runtime (`lastChangelogVersion` bumps on upgrade),
|
||||
which would dirty a symlinked repo file. Instead, bootstrap with:
|
||||
### 1. Dotfiles (if you keep one)
|
||||
|
||||
Brings `~/.config/pi/.env` (AWS creds, git-crypt encrypted), tmux CSI-u
|
||||
extended keys, and other machine state:
|
||||
|
||||
```bash
|
||||
cp /path/to/mempalace-toolkit/extensions/pi/settings.example.json \
|
||||
~/.pi/agent/settings.json
|
||||
$EDITOR ~/.pi/agent/settings.json
|
||||
git clone <your-dotfiles> ~/src/dotfiles
|
||||
cd ~/src/dotfiles
|
||||
git-crypt unlock <key>
|
||||
./provision.sh --profile <profile> # or your equivalent tool
|
||||
```
|
||||
|
||||
The Bedrock inference-profile prefix on model IDs (`eu.`, `us.`) is
|
||||
**region-specific** and must match `AWS_REGION` in `~/.config/pi/.env`.
|
||||
For a bare Anthropic provider (non-Bedrock) drop the prefix entirely
|
||||
and use `anthropic:claude-...`. Run `pi --list-models` to confirm what
|
||||
your credentials can actually invoke.
|
||||
### 2. Install pi upstream
|
||||
|
||||
`install.sh` warns (non-fatal) if `settings.json` is missing.
|
||||
|
||||
## Environment setup
|
||||
|
||||
pi with `defaultProvider=amazon-bedrock` needs `AWS_PROFILE` and
|
||||
`AWS_REGION` exported into the shell that launches it. Recommended
|
||||
layout (matches the tor-ms22 dotfiles pattern):
|
||||
|
||||
```
|
||||
~/.config/pi/.env ← AWS_PROFILE=..., AWS_REGION=...
|
||||
(git-crypt encrypted in dotfiles repo)
|
||||
~/.oh-my-zsh/custom/pi-env.zsh ← installed by mempalace-toolkit install.sh
|
||||
(sources the .env into every shell)
|
||||
```bash
|
||||
brew install pi-coding-agent # macOS
|
||||
# or see https://github.com/mariozechner/pi-coding-agent for Linux
|
||||
pi --help # creates ~/.pi/agent/
|
||||
```
|
||||
|
||||
The loader file `pi-env.zsh` is canonical here in `extensions/pi/` and
|
||||
installed by `install.sh` in one of two ways:
|
||||
### 3. Install pi-toolkit (base pi config)
|
||||
|
||||
| Detected | Action |
|
||||
|---|---|
|
||||
| `~/.oh-my-zsh/custom/` exists | `cp` (not symlink) into that directory — auto-loaded by omz on every new shell. cp not symlink because that directory is part of the dotfiles backup, and a symlink into mempalace-toolkit would break when the backup is restored on another host. |
|
||||
| No oh-my-zsh | Prints a shell-specific `source <repo>/extensions/pi/pi-env.zsh` snippet for `~/.zshrc` or `~/.bashrc`. Installer does not auto-edit rc files. |
|
||||
```bash
|
||||
git clone ssh://git@gitea.jordbo.se:2222/joakimp/pi-toolkit.git ~/pi-toolkit
|
||||
cd ~/pi-toolkit && ./install.sh
|
||||
```
|
||||
|
||||
The loader itself is POSIX-compatible (`set -a` / `source` / `set +a`),
|
||||
so bash users can source it directly — no zsh dependency in the file.
|
||||
Symlinks `keybindings.json`, copies `pi-env.zsh` into
|
||||
`~/.oh-my-zsh/custom/`, and prints the `settings.json` bootstrap command.
|
||||
|
||||
Re-runs are idempotent: if the installed copy matches the repo, prints
|
||||
"already installed". If it differs, leaves your edits alone and points
|
||||
at `diff` for comparison. Uninstall only removes the file if it still
|
||||
matches the repo copy; local edits are preserved.
|
||||
### 4. Bootstrap pi settings
|
||||
|
||||
Historical note: these vars used to live under a `# Environment variables
|
||||
for pi` block inside `~/.config/opencode/.env`. Split out 2026-05-05 so
|
||||
each tool owns its own env file. `install.sh` runs a `check_aws_env`
|
||||
probe that warns if the vars are missing and points back here.
|
||||
```bash
|
||||
cp ~/pi-toolkit/settings.example.json ~/.pi/agent/settings.json
|
||||
$EDITOR ~/.pi/agent/settings.json # eu./us./anthropic: prefix
|
||||
```
|
||||
|
||||
### 5. Install mempalace CLI + this toolkit
|
||||
|
||||
```bash
|
||||
uv tool install mempalace
|
||||
git clone ssh://git@gitea.jordbo.se:2222/joakimp/mempalace-toolkit.git ~/mempalace-toolkit
|
||||
cd ~/mempalace-toolkit && ./install.sh
|
||||
```
|
||||
|
||||
Detects pi, symlinks `mempalace.ts` into `~/.pi/agent/extensions/`.
|
||||
Also detects pi-toolkit artifacts and prints a green check (or a warning
|
||||
telling you to install pi-toolkit first if you skipped step 3).
|
||||
|
||||
### 6. Register mempalace MCP with opencode (if applicable)
|
||||
|
||||
Skip if this box is pi-only. Otherwise:
|
||||
- Install [`opencode-toolkit`](https://gitea.jordbo.se/joakimp/opencode-toolkit) so `~/.config/opencode/.env` is sourced into every shell (GitHub / Gitea / other MCP server tokens).
|
||||
- Register the mempalace MCP server in `~/.config/opencode/opencode.json` — see [root README § Registering mempalace with opencode](../../README.md#registering-mempalace-with-opencode-or-other-mcp-clients).
|
||||
|
||||
### 7. First run
|
||||
|
||||
```bash
|
||||
exec zsh
|
||||
pi # should start with defaults; wake-up injection shows palace status
|
||||
```
|
||||
|
||||
If the wake-up doesn't print, run `MEMPALACE_EXT_DEBUG=1 pi` to surface
|
||||
`mempalace-mcp` stderr.
|
||||
|
||||
### Verification checklist
|
||||
|
||||
```bash
|
||||
# MCP bridge in place
|
||||
ls -la ~/.pi/agent/extensions/mempalace.ts # → this repo
|
||||
|
||||
# pi-toolkit artifacts also in place
|
||||
ls -la ~/.pi/agent/keybindings.json # → pi-toolkit
|
||||
ls -la ~/.oh-my-zsh/custom/pi-env.zsh # cp from pi-toolkit
|
||||
|
||||
# Env loaded
|
||||
zsh -ic 'echo $AWS_PROFILE $AWS_REGION'
|
||||
|
||||
# Palace reachable
|
||||
mempalace status
|
||||
```
|
||||
|
||||
### Uninstall
|
||||
|
||||
```bash
|
||||
cd ~/mempalace-toolkit && ./install.sh --uninstall --yes # bridge only
|
||||
cd ~/pi-toolkit && ./install.sh --uninstall --yes # pi base config
|
||||
# Leaves pi itself, mempalace CLI, and ~/.config/pi/.env alone.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
@@ -297,14 +196,11 @@ probe that warns if the vars are missing and points back here.
|
||||
mempalace-toolkit/
|
||||
└── extensions/
|
||||
└── pi/
|
||||
├── README.md ← this file
|
||||
├── mempalace.ts ← symlinked into ~/.pi/agent/extensions/
|
||||
├── keybindings.json ← symlinked into ~/.pi/agent/
|
||||
├── pi-env.zsh ← cp'd into ~/.oh-my-zsh/custom/ (or source'd manually for bash)
|
||||
└── settings.example.json ← template; copy + edit into ~/.pi/agent/
|
||||
├── README.md ← this file
|
||||
└── mempalace.ts ← symlinked into ~/.pi/agent/extensions/
|
||||
```
|
||||
|
||||
`install.sh` detects pi by probing for `~/.pi/agent/extensions/` and
|
||||
only creates symlinks when that directory exists. On machines without
|
||||
pi the files stay dormant in the repo. Re-runs are idempotent (same
|
||||
pattern as `bin/` and `SKILL.md`).
|
||||
Pi base config (keybindings, env loader, settings template) lives in
|
||||
[`pi-toolkit`](https://gitea.jordbo.se/joakimp/pi-toolkit). `install.sh`
|
||||
detects pi via `~/.pi/agent/extensions/` and runs a `check_pi_toolkit`
|
||||
probe that warns if pi-toolkit's artifacts are missing.
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"tui.input.newLine": ["shift+enter", "ctrl+j", "alt+j"]
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
# Load pi coding-agent environment variables from ~/.config/pi/.env
|
||||
#
|
||||
# Canonical source: mempalace-toolkit/extensions/pi/pi-env.zsh
|
||||
# Installed by mempalace-toolkit/install.sh via `cp` (not symlink) to keep
|
||||
# ~/.oh-my-zsh/custom/ portable across machines with different $HOME paths.
|
||||
# See extensions/pi/README.md#environment-setup for the full story.
|
||||
#
|
||||
# Sources ~/.config/pi/.env (AWS_PROFILE, AWS_REGION, and any future
|
||||
# pi-scoped secrets) so pi's Bedrock provider works when spawned from any
|
||||
# shell. The .env file itself is shipped (git-crypt encrypted) from the
|
||||
# myconfigs dotfiles repo.
|
||||
#
|
||||
# `set -a` auto-exports every assignment in the sourced file, so plain
|
||||
# KEY=VALUE lines become exported env vars without needing `export` in .env.
|
||||
# Also works in bash (set -a and source are POSIX) — non-oh-my-zsh users
|
||||
# can source this file directly from ~/.bashrc or ~/.zshrc instead.
|
||||
#
|
||||
# Historical note: these vars used to live in ~/.config/opencode/.env
|
||||
# under a "# Environment variables for pi" block. Split out 2026-05-05
|
||||
# so each tool owns its own env file.
|
||||
|
||||
_pi_env="${HOME}/.config/pi/.env"
|
||||
if [[ -r "${_pi_env}" ]]; then
|
||||
set -a
|
||||
source "${_pi_env}"
|
||||
set +a
|
||||
fi
|
||||
unset _pi_env
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"_comment": "Template for ~/.pi/agent/settings.json. Copy to that path and adjust for your region/account — this file is NOT symlinked by install.sh because pi rewrites settings.json at runtime (lastChangelogVersion bumps), which would dirty the repo. This template exists so a fresh machine can start pi without --model by copying + editing.",
|
||||
"_comment_models": "The 'eu.' prefix on Bedrock model IDs is an inference-profile prefix tied to the AWS region. Must match AWS_REGION in ~/.config/pi/.env. For us-east use 'us.anthropic.*'; for bare Anthropic provider (non-Bedrock) use the raw 'anthropic:claude-*' IDs. Run `pi --list-models` to see what your credentials can actually invoke.",
|
||||
|
||||
"defaultProvider": "amazon-bedrock",
|
||||
"defaultModel": "eu.anthropic.claude-sonnet-4-6",
|
||||
"enabledModels": [
|
||||
"eu.anthropic.claude-sonnet-4-6",
|
||||
"eu.anthropic.claude-opus-4-7",
|
||||
"eu.anthropic.claude-haiku-4-5-20251001-v1:0"
|
||||
]
|
||||
}
|
||||
+43
-175
@@ -16,23 +16,13 @@ SKILL_SRC="${SCRIPT_DIR}/SKILL.md"
|
||||
SKILL_DEST_DIR="${HOME}/.agents/skills/opencode-mempalace-bridge"
|
||||
SKILL_DEST="${SKILL_DEST_DIR}/SKILL.md"
|
||||
|
||||
# pi coding-agent extension (optional — only linked if pi is installed)
|
||||
# pi coding-agent MCP bridge extension (optional — only linked if pi is installed)
|
||||
# Pi-generic config (env loader, keybindings, settings template) lives in
|
||||
# the pi-toolkit repo; install it separately for the base pi bring-up.
|
||||
PI_EXT_SRC="${SCRIPT_DIR}/extensions/pi/mempalace.ts"
|
||||
PI_EXT_DEST_DIR="${HOME}/.pi/agent/extensions"
|
||||
PI_EXT_DEST="${PI_EXT_DEST_DIR}/mempalace.ts"
|
||||
|
||||
# pi keybindings (generic mosh/tmux newline fix — safe on any machine)
|
||||
PI_KEYS_SRC="${SCRIPT_DIR}/extensions/pi/keybindings.json"
|
||||
PI_KEYS_DEST="${HOME}/.pi/agent/keybindings.json"
|
||||
|
||||
# pi settings template (NOT symlinked — pi rewrites this file at runtime)
|
||||
PI_SETTINGS_EXAMPLE="${SCRIPT_DIR}/extensions/pi/settings.example.json"
|
||||
PI_SETTINGS_DEST="${HOME}/.pi/agent/settings.json"
|
||||
|
||||
# pi env loader (shell glue that sources ~/.config/pi/.env into every shell)
|
||||
PI_ENV_SRC="${SCRIPT_DIR}/extensions/pi/pi-env.zsh"
|
||||
PI_ENV_OMZ_DEST="${HOME}/.oh-my-zsh/custom/pi-env.zsh"
|
||||
|
||||
# ── args ─────────────────────────────────────────────
|
||||
ACTION="install"
|
||||
ASSUME_YES="no"
|
||||
@@ -56,31 +46,22 @@ What install does:
|
||||
(auto-discovered by opencode; run agents-sync from cli_utils to also
|
||||
reach Claude Code and Kiro)
|
||||
- If pi (~/.pi/agent/extensions/) exists, symlinks extensions/pi/mempalace.ts
|
||||
into ~/.pi/agent/extensions/mempalace.ts (pi bridge). Skipped otherwise.
|
||||
- If pi exists, symlinks extensions/pi/keybindings.json into
|
||||
~/.pi/agent/keybindings.json (generic mosh/tmux newline fix).
|
||||
- If pi exists, warns if ~/.pi/agent/settings.json is missing and points
|
||||
at extensions/pi/settings.example.json as a template (NOT symlinked —
|
||||
pi rewrites this file at runtime).
|
||||
- If oh-my-zsh is detected (~/.oh-my-zsh/custom/ exists), copies
|
||||
extensions/pi/pi-env.zsh into ~/.oh-my-zsh/custom/pi-env.zsh so every
|
||||
new zsh shell sources ~/.config/pi/.env. Uses cp (not symlink) because
|
||||
that dir gets backed up by rsync_copy and symlinks would break
|
||||
portability. Re-runs are idempotent when content matches the repo;
|
||||
warns and leaves local edits alone if they differ.
|
||||
- If oh-my-zsh is NOT detected, prints a shell-specific source snippet
|
||||
for ~/.zshrc or ~/.bashrc. Does not auto-edit rc files.
|
||||
- Warns if AWS_PROFILE / AWS_REGION are unset (only relevant to users
|
||||
whose pi settings.json selects amazon-bedrock as defaultProvider).
|
||||
into ~/.pi/agent/extensions/mempalace.ts (the pi↔mempalace MCP bridge).
|
||||
Skipped on machines without pi.
|
||||
- Warns if pi is installed but pi-toolkit doesn't appear to be (i.e. the
|
||||
keybindings, env loader, and settings template are missing). pi-toolkit
|
||||
is a separate repo owning pi's own config: split out 2026-05-05.
|
||||
Clone: ssh://git@gitea.jordbo.se:2222/joakimp/pi-toolkit.git
|
||||
- Drops a .skill-source marker in the skill dir so sibling tooling
|
||||
(deploy-skills.sh, agents-sync.zsh) knows the dir is externally owned
|
||||
|
||||
What uninstall does:
|
||||
- Removes symlinks in ~/.local/bin/ that point into this repo
|
||||
- Removes the skill symlink if it points into this repo
|
||||
- Removes the pi extension symlink if it points into this repo
|
||||
- Removes the pi keybindings symlink if it points into this repo
|
||||
- Removes the pi↔mempalace MCP bridge symlink if it points into this repo
|
||||
- Removes the .skill-source marker and empty skill dir
|
||||
- Does NOT touch pi-toolkit-owned artifacts (keybindings, env loader).
|
||||
Run pi-toolkit/install.sh --uninstall for those.
|
||||
EOF
|
||||
exit 0 ;;
|
||||
*) echo "Unknown flag: $1" >&2; exit 2 ;;
|
||||
@@ -285,127 +266,38 @@ install_pi_extension() {
|
||||
printf ' at startup only).\n'
|
||||
}
|
||||
|
||||
install_pi_keybindings() {
|
||||
# Generic mosh/tmux newline fix. Non-destructive: if a real
|
||||
# keybindings.json exists we back it up rather than clobber.
|
||||
[[ -d "$PI_EXT_DEST_DIR" ]] || return 0 # no pi → no keybindings
|
||||
|
||||
note "Linking pi keybindings → $PI_KEYS_DEST"
|
||||
if [[ -e "$PI_KEYS_DEST" || -L "$PI_KEYS_DEST" ]]; then
|
||||
if link_if_into_repo "$PI_KEYS_DEST"; then
|
||||
ok "pi keybindings already linked"
|
||||
return 0
|
||||
fi
|
||||
local backup="${PI_KEYS_DEST}.bak.$(date +%Y%m%d-%H%M%S)"
|
||||
mv "$PI_KEYS_DEST" "$backup"
|
||||
warn "Existing $PI_KEYS_DEST backed up to $backup"
|
||||
fi
|
||||
ln -s "$PI_KEYS_SRC" "$PI_KEYS_DEST"
|
||||
ok "Linked keybindings.json → $PI_KEYS_SRC"
|
||||
}
|
||||
# ── Pi-toolkit detection ─────────────────────────────────────────
|
||||
# Pi-generic config (keybindings, settings template, shell env loader) lives
|
||||
# in the sibling pi-toolkit repo. This file used to own those; the split
|
||||
# happened 2026-05-05 so opencode-devbox can build slim containers that
|
||||
# include pi without dragging in mempalace. We don't install those artifacts
|
||||
# here — we only print a pointer when pi is detected but pi-toolkit isn't.
|
||||
check_pi_toolkit() {
|
||||
[[ -d "$PI_EXT_DEST_DIR" ]] || return 0 # no pi → nothing to say
|
||||
|
||||
install_pi_env_loader() {
|
||||
# Ship pi-env.zsh (sources ~/.config/pi/.env so AWS vars etc. are in
|
||||
# every shell that starts pi). Two paths depending on shell setup:
|
||||
#
|
||||
# 1. oh-my-zsh present → cp into ~/.oh-my-zsh/custom/ (auto-loaded by
|
||||
# omz). cp not symlink because that directory is typically part of
|
||||
# a dotfiles backup (rsync_copy.sh in the myconfigs repo) and a
|
||||
# symlink into mempalace-toolkit would break when restored on
|
||||
# another host.
|
||||
# 2. No oh-my-zsh → print a source snippet for ~/.zshrc or ~/.bashrc.
|
||||
# We don't auto-edit rc files — too invasive for an optional glue
|
||||
# file. The loader itself is POSIX-compatible (set -a / source /
|
||||
# set +a), so bash users can source it directly.
|
||||
# Best-effort detection: pi-toolkit installs keybindings.json as a
|
||||
# symlink and copies pi-env.zsh into ~/.oh-my-zsh/custom/. We don't
|
||||
# know where the pi-toolkit repo is cloned, so just check whether the
|
||||
# downstream artifacts exist.
|
||||
local has_keys="no"
|
||||
local has_env="no"
|
||||
[[ -L "$HOME/.pi/agent/keybindings.json" ]] && has_keys="yes"
|
||||
[[ -f "$HOME/.oh-my-zsh/custom/pi-env.zsh" ]] && has_env="yes"
|
||||
|
||||
[[ -d "$PI_EXT_DEST_DIR" ]] || return 0 # no pi → skip
|
||||
|
||||
if [[ -d "$HOME/.oh-my-zsh/custom" ]]; then
|
||||
note "Installing pi-env.zsh into ~/.oh-my-zsh/custom/"
|
||||
if [[ -f "$PI_ENV_OMZ_DEST" ]]; then
|
||||
if cmp -s "$PI_ENV_SRC" "$PI_ENV_OMZ_DEST"; then
|
||||
ok "pi-env.zsh already installed (content matches repo)"
|
||||
return 0
|
||||
fi
|
||||
warn "$PI_ENV_OMZ_DEST exists and differs from repo copy"
|
||||
printf ' Leaving your edits alone. Compare with:\n'
|
||||
printf ' diff %q %q\n' "$PI_ENV_OMZ_DEST" "$PI_ENV_SRC"
|
||||
printf ' To adopt the repo version: rm that file and re-run install.sh\n'
|
||||
return 0
|
||||
fi
|
||||
cp "$PI_ENV_SRC" "$PI_ENV_OMZ_DEST"
|
||||
ok "Copied pi-env.zsh → $PI_ENV_OMZ_DEST"
|
||||
printf ' Open a new shell (or `exec zsh`) to load AWS_PROFILE / AWS_REGION.\n'
|
||||
if [[ "$has_keys" == "yes" || "$has_env" == "yes" ]]; then
|
||||
ok "pi-toolkit artifacts detected (keybindings=$has_keys env-loader=$has_env)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# No oh-my-zsh — print shell-specific snippet.
|
||||
note "oh-my-zsh not detected — manual shell setup needed"
|
||||
local shell_name
|
||||
shell_name="$(basename "${SHELL:-bash}")"
|
||||
local rc_file
|
||||
case "$shell_name" in
|
||||
zsh) rc_file="~/.zshrc" ;;
|
||||
bash) rc_file="~/.bashrc" ;;
|
||||
*) rc_file="~/.${shell_name}rc # adjust for your shell" ;;
|
||||
esac
|
||||
printf ' Add this line to %s so every shell sources ~/.config/pi/.env:\n' "$rc_file"
|
||||
printf ' source %q\n' "$PI_ENV_SRC"
|
||||
printf ' (the loader itself is POSIX-compatible — works in bash and zsh.)\n'
|
||||
}
|
||||
|
||||
# ── Verify ~/.pi/agent/settings.json exists ──────────────────────────
|
||||
# If pi is installed but settings.json is missing, `pi` refuses to start
|
||||
# without `--provider ... --model ...` on every invocation. The toolkit
|
||||
# ships extensions/pi/settings.example.json as a template with a working
|
||||
# Bedrock (eu-west-1) stanza — copy + edit for your region/account.
|
||||
#
|
||||
# NOT symlinked: pi rewrites settings.json at runtime (lastChangelogVersion
|
||||
# bumps on upgrade), which would dirty the repo and cause merge noise.
|
||||
# Template-only install is the right trade-off.
|
||||
check_pi_settings() {
|
||||
[[ -d "$PI_EXT_DEST_DIR" ]] || return 0 # no pi → nothing to check
|
||||
|
||||
if [[ -f "$PI_SETTINGS_DEST" ]]; then
|
||||
ok "pi settings.json present at $PI_SETTINGS_DEST"
|
||||
return 0
|
||||
fi
|
||||
|
||||
warn "pi settings.json NOT found at $PI_SETTINGS_DEST"
|
||||
printf ' Without it, pi must be invoked with --provider/--model on every run.\n'
|
||||
printf ' Bootstrap from the shipped template:\n'
|
||||
printf ' cp %q %q\n' "$PI_SETTINGS_EXAMPLE" "$PI_SETTINGS_DEST"
|
||||
printf ' $EDITOR %q # adjust region prefix + model IDs\n' "$PI_SETTINGS_DEST"
|
||||
printf ' See extensions/pi/README.md for the eu./us./anthropic: prefix rules.\n'
|
||||
return 0
|
||||
}
|
||||
|
||||
# ── Verify AWS env vars are present for Bedrock-backed pi ────────────
|
||||
# Only meaningful if pi's settings.json selects amazon-bedrock. We do a
|
||||
# best-effort grep rather than parsing JSON — false positives are cheap
|
||||
# (one extra probe) and the check is gated on pi being installed at all.
|
||||
check_aws_env() {
|
||||
[[ -d "$PI_EXT_DEST_DIR" ]] || return 0 # no pi → nothing to check
|
||||
|
||||
# Only warn if settings.json selects amazon-bedrock. If pi uses a
|
||||
# non-Bedrock provider (bare anthropic, openai, ...) AWS creds are
|
||||
# irrelevant and this probe would be noise. If settings.json doesn't
|
||||
# exist yet, check_pi_settings already told the user to bootstrap it
|
||||
# — we can't know which provider they'll pick, so stay quiet here.
|
||||
[[ -f "$PI_SETTINGS_DEST" ]] || return 0
|
||||
grep -q '"amazon-bedrock"' "$PI_SETTINGS_DEST" 2>/dev/null || return 0
|
||||
|
||||
if [[ -n "${AWS_PROFILE:-}" && -n "${AWS_REGION:-}" ]]; then
|
||||
ok "AWS env present (AWS_PROFILE=$AWS_PROFILE, AWS_REGION=$AWS_REGION)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
warn "AWS_PROFILE and/or AWS_REGION not set in this shell"
|
||||
printf ' pi with defaultProvider=amazon-bedrock needs both to invoke Bedrock.\n'
|
||||
printf ' Recommended layout (matches the tor-ms22 dotfiles pattern):\n'
|
||||
printf ' ~/.config/pi/.env # AWS_PROFILE=..., AWS_REGION=...\n'
|
||||
printf ' ~/.oh-my-zsh/custom/pi-env.zsh # set -a; source ~/.config/pi/.env; set +a\n'
|
||||
printf ' See extensions/pi/README.md#environment-setup for the template.\n'
|
||||
warn "pi detected but pi-toolkit doesn't appear installed"
|
||||
printf ' pi-toolkit ships pi'"'"'s own config (keybindings, env loader,\n'
|
||||
printf ' settings template) — formerly part of this repo, split out\n'
|
||||
printf ' 2026-05-05. Install it separately for the full pi bring-up:\n'
|
||||
printf ' git clone ssh://git@gitea.jordbo.se:2222/joakimp/pi-toolkit.git\n'
|
||||
printf ' cd pi-toolkit && ./install.sh\n'
|
||||
printf ' This toolkit'"'"'s install still does the pi↔mempalace MCP bridge\n'
|
||||
printf ' (mempalace.ts extension) regardless — that part is mempalace-side.\n'
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -419,7 +311,7 @@ do_install() {
|
||||
echo " Symlink SKILL.md into $SKILL_DEST"
|
||||
if [[ -d "$PI_EXT_DEST_DIR" ]]; then
|
||||
echo " Symlink extensions/pi/mempalace.ts into $PI_EXT_DEST"
|
||||
echo " Symlink extensions/pi/keybindings.json into $PI_KEYS_DEST"
|
||||
echo " (install pi-toolkit separately for keybindings + env loader + settings template)"
|
||||
fi
|
||||
echo
|
||||
confirm || { echo "Aborted."; exit 0; }
|
||||
@@ -430,19 +322,13 @@ do_install() {
|
||||
echo
|
||||
install_pi_extension
|
||||
echo
|
||||
install_pi_keybindings
|
||||
echo
|
||||
install_pi_env_loader
|
||||
echo
|
||||
check_path
|
||||
echo
|
||||
check_wake_up_protocol
|
||||
echo
|
||||
check_opencode_mcp
|
||||
echo
|
||||
check_pi_settings
|
||||
echo
|
||||
check_aws_env
|
||||
check_pi_toolkit
|
||||
echo
|
||||
ok "Done."
|
||||
echo
|
||||
@@ -491,27 +377,9 @@ do_uninstall() {
|
||||
ok "No pi extension symlink to remove"
|
||||
fi
|
||||
|
||||
echo
|
||||
note "Removing pi keybindings symlink"
|
||||
if link_if_into_repo "$PI_KEYS_DEST"; then
|
||||
rm "$PI_KEYS_DEST"
|
||||
ok "Removed pi keybindings symlink"
|
||||
else
|
||||
ok "No pi keybindings symlink to remove"
|
||||
fi
|
||||
|
||||
echo
|
||||
note "Removing pi-env.zsh loader (oh-my-zsh path)"
|
||||
# Only remove if content still matches the repo copy — user may have
|
||||
# local edits we shouldn't silently discard.
|
||||
if [[ -f "$PI_ENV_OMZ_DEST" ]] && cmp -s "$PI_ENV_SRC" "$PI_ENV_OMZ_DEST"; then
|
||||
rm "$PI_ENV_OMZ_DEST"
|
||||
ok "Removed $PI_ENV_OMZ_DEST"
|
||||
elif [[ -f "$PI_ENV_OMZ_DEST" ]]; then
|
||||
warn "$PI_ENV_OMZ_DEST differs from repo copy — left alone"
|
||||
else
|
||||
ok "No pi-env.zsh loader to remove"
|
||||
fi
|
||||
# Note: pi keybindings + pi-env.zsh loader are owned by pi-toolkit now
|
||||
# (split 2026-05-05). Run `pi-toolkit/install.sh --uninstall` to remove
|
||||
# those artifacts. We deliberately do not touch them here.
|
||||
|
||||
# Remove the marker and the now-empty skill directory, but only if
|
||||
# the marker was written by us and the directory has nothing else in it.
|
||||
|
||||
Reference in New Issue
Block a user