Add ext-toggle extension and /ext slash command
extensions/ext-toggle.ts: /ext lists ~/.pi/agent/extensions/ with active/disabled markers and toggles individual extensions by renaming between name.ts and name.ts.off (pi only auto-discovers *.ts). Calls ctx.reload() so the change takes effect without restarting pi. Subdirectory-style extensions (name/index.ts) are listed read-only in v1 — toggling a directory cleanly is more work than the rename trick is worth. install.sh: --uninstall now matches both *.ts and *.ts.off symlinks pointing into this repo, so a disabled extension is still cleaned up. README.md / AGENTS.md: Document ext-toggle alongside the others; AGENTS notes the API surface used (registerCommand, ui.select/confirm/notify, reload) and the rename-not-delete design decision.
This commit is contained in:
+12
-7
@@ -182,13 +182,18 @@ do_uninstall() {
|
||||
echo
|
||||
|
||||
local removed=0
|
||||
for dest in "${EXTENSIONS_DEST}"/*.ts; do
|
||||
[[ -e "$dest" || -L "$dest" ]] || continue
|
||||
if link_into_repo "$dest"; then
|
||||
rm "$dest"
|
||||
ok "Removed $(basename "$dest")"
|
||||
(( removed++ )) || true
|
||||
fi
|
||||
# Match both active (.ts) and disabled (.ts.off) symlinks — the ext-toggle
|
||||
# extension can rename a link to .ts.off to disable it, and uninstall
|
||||
# should still clean those up.
|
||||
for pattern in "*.ts" "*.ts.off"; do
|
||||
for dest in "${EXTENSIONS_DEST}"/$pattern; do
|
||||
[[ -e "$dest" || -L "$dest" ]] || continue
|
||||
if link_into_repo "$dest"; then
|
||||
rm "$dest"
|
||||
ok "Removed $(basename "$dest")"
|
||||
(( removed++ )) || true
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [[ $removed -eq 0 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user