ext-toggle: refuse to disable ssh-controlmaster during --ssh session

Disabling ssh-controlmaster mid --ssh session would tear down the
ControlMaster (if we own it) and silently redirect read/write/edit/bash
back to the local filesystem while the system prompt still claims we're
on the remote. Now blocked with an explanatory dialog.

Implementation: a DISABLE_GUARDS map keyed by bare extension name lets
specific extensions register a refusal predicate. ssh-controlmaster's
guard checks process.argv for --ssh and refuses if present. Easy to
extend with similar foot-guns later.
This commit is contained in:
2026-05-07 20:43:20 +02:00
parent 9f38ba7797
commit c624eafe64
3 changed files with 49 additions and 0 deletions
+8
View File
@@ -181,6 +181,14 @@ effect without restarting pi.
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.
- **Per-extension disable guards.** A `DISABLE_GUARDS` map keyed by bare
extension name lets specific extensions refuse a `/ext` disable when
toggling would silently break in-flight session state. Currently used
by `ssh-controlmaster`: refuses to disable while `--ssh` is in
`process.argv`, because disabling tears down the ControlMaster (if we
own it) and reverts read/write/edit/bash to the local filesystem while
the system prompt still says we're on the remote. Add new entries here
as similar foot-guns are discovered.
- **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