install.sh: respect /ext disabled state on re-run

When linking, check for <name>.ts.off pointing into this repo and skip
relinking if found. Means a previously /ext-disabled extension stays
disabled across install.sh re-runs (e.g. when adding a new extension).

README + AGENTS updated with the new behavior.
This commit is contained in:
2026-05-07 20:37:11 +02:00
parent d2b2b3fb43
commit 9f38ba7797
3 changed files with 14 additions and 0 deletions
+5
View File
@@ -176,6 +176,11 @@ effect without restarting pi.
- **Symlink-friendly.** `fs.renameSync` renames the symlink itself; the repo - **Symlink-friendly.** `fs.renameSync` renames the symlink itself; the repo
target is untouched. Toggling an extension installed by this repo is target is untouched. Toggling an extension installed by this repo is
reversible without re-running `install.sh`. reversible without re-running `install.sh`.
- **`install.sh` respects the disabled state.** When linking, the installer
first checks for a `<name>.ts.off` symlink pointing into this repo and
skips re-linking if found. So re-running `./install.sh` (e.g. to pick up
a newly added extension) does not silently re-enable a previously
`/ext`-disabled extension.
- **Subdir extensions are read-only in v1.** `name/index.ts` shapes show up in - **Subdir extensions are read-only in v1.** `name/index.ts` shapes show up in
the listing with a `[dir]` tag but cannot be toggled — the cleanest disable the listing with a `[dir]` tag but cannot be toggled — the cleanest disable
for a directory would need a hidden-prefix or move-aside dance that adds for a directory would need a hidden-prefix or move-aside dance that adds
+1
View File
@@ -176,6 +176,7 @@ Registers `/ext` — a slash command that lists extensions in `~/.pi/agent/exten
**Notes:** **Notes:**
- Subdirectory-style extensions (`name/index.ts`) are listed read-only — v1 doesn't toggle them. Move the directory aside manually if needed. - Subdirectory-style extensions (`name/index.ts`) are listed read-only — v1 doesn't toggle them. Move the directory aside manually if needed.
- `install.sh --uninstall` cleans up both `.ts` and `.ts.off` symlinks pointing into this repo, so a disabled extension won't be left behind. - `install.sh --uninstall` cleans up both `.ts` and `.ts.off` symlinks pointing into this repo, so a disabled extension won't be left behind.
- Re-running `./install.sh` respects a prior `/ext` disable: if `<name>.ts.off` already exists, the installer leaves it alone instead of silently re-enabling.
## Adding a new extension ## Adding a new extension
+8
View File
@@ -151,9 +151,17 @@ do_install() {
in_install_set "$bare" || continue in_install_set "$bare" || continue
local dest="${EXTENSIONS_DEST}/${name}" local dest="${EXTENSIONS_DEST}/${name}"
local disabled="${dest}.off"
note "Linking ${name}" note "Linking ${name}"
# Respect a prior /ext disable: if <name>.ts.off exists and points
# into this repo, leave it alone. ext-toggle will flip it back.
if [[ -L "$disabled" ]] && link_into_repo "$disabled"; then
ok "${name} kept disabled (${name}.off present)"
continue
fi
if [[ -e "$dest" || -L "$dest" ]]; then if [[ -e "$dest" || -L "$dest" ]]; then
if link_into_repo "$dest"; then if link_into_repo "$dest"; then
ok "${name} already linked" ok "${name} already linked"