From 9f38ba779705036a95930e104eef46e00419ecdb Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Thu, 7 May 2026 20:37:11 +0200 Subject: [PATCH] install.sh: respect /ext disabled state on re-run When linking, check for .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. --- AGENTS.md | 5 +++++ README.md | 1 + install.sh | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 3a9a4e1..0de55cb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -176,6 +176,11 @@ effect without restarting pi. - **Symlink-friendly.** `fs.renameSync` renames the symlink itself; the repo target is untouched. Toggling an extension installed by this repo is reversible without re-running `install.sh`. +- **`install.sh` respects the disabled state.** When linking, the installer + first checks for a `.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 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 diff --git a/README.md b/README.md index 7135d6e..9b0ec5e 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,7 @@ Registers `/ext` — a slash command that lists extensions in `~/.pi/agent/exten **Notes:** - 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. +- Re-running `./install.sh` respects a prior `/ext` disable: if `.ts.off` already exists, the installer leaves it alone instead of silently re-enabling. ## Adding a new extension diff --git a/install.sh b/install.sh index 5683542..8aa98a4 100755 --- a/install.sh +++ b/install.sh @@ -151,9 +151,17 @@ do_install() { in_install_set "$bare" || continue local dest="${EXTENSIONS_DEST}/${name}" + local disabled="${dest}.off" note "Linking ${name}" + # Respect a prior /ext disable: if .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 link_into_repo "$dest"; then ok "${name} already linked"