From b7b2768fb7c5e0646659da4a55fe95f0d48f41a5 Mon Sep 17 00:00:00 2001 From: Patrick Demichiel Date: Tue, 10 Nov 2026 20:40:23 +0100 Subject: [PATCH 1/4] fix: list only installed patch packs in a Debug build A Debug build reads pack patches from packaging/content/ and also listed every pack the repo carries, so a fresh checkout showed Chorus, Delay and the three reverbs in the drawer with no package installed and none of their plugins present. The repo's sources now shadow installed packs but no longer add packs; PLECTRIFY_LIST_UNINSTALLED_PACKS=1 restores the old listing for authoring a pack before its first publish. Closes #43 --- AGENTS.md | 13 +++++++++---- Source/app/PlectrifyEngine.cpp | 23 +++++++++++++++++++---- Source/app/PlectrifyEngine.h | 5 +++++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c1be544..7a93c70 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1861,10 +1861,15 @@ the repo says it is — no `host`, no publish, no install. The override is keyed folder a patch occupies in `patches/` and applies file by file (`MainComponent::sharedPatchSources`), so it reads both shapes `host` ships — the wrapped single patch and a pack of several, whose subfolders install under -their own names. A pack the repo carries is listed whether it is installed or -not, so a brand-new one shows up in the drawer. Only this platform's folder is -read; the OS-neutral `content//` shape counts only if it holds a -`patch.json`. +their own names. It **shadows packs, it does not add them**: the drawer lists +only what is installed, because a pack listed without its package offers a tile +whose plugin and assets are not on this machine — which is what a fresh Debug +checkout used to show, the repo's whole collection with nothing installed +(issue #43). Authoring a brand-new pack before its first publish is the one +case that wants it listed anyway, so that is an explicit opt-in: +`PLECTRIFY_LIST_UNINSTALLED_PACKS=1` in the launch environment +(`listUninstalledPackSources`). Only this platform's folder is read; the +OS-neutral `content//` shape counts only if it holds a `patch.json`. **And a Debug build can write those sources back.** A pack patch loaded on a module offers *Update pack source "…"* in the patch menu wherever the repo has diff --git a/Source/app/PlectrifyEngine.cpp b/Source/app/PlectrifyEngine.cpp index 01cf171..769899b 100644 --- a/Source/app/PlectrifyEngine.cpp +++ b/Source/app/PlectrifyEngine.cpp @@ -2833,6 +2833,12 @@ juce::StringArray PlectrifyEngine::sharedPatchSourceIds() return ids; } +bool PlectrifyEngine::listUninstalledPackSources() +{ + return juce::SystemStats::getEnvironmentVariable ("PLECTRIFY_LIST_UNINSTALLED_PACKS", {}) + .trim() == "1"; +} + bool PlectrifyEngine::resolveSharedSourceFile (const juce::String& rel, juce::File& out) { const auto relative = rel.replaceCharacter ('\\', '/'); @@ -3039,16 +3045,25 @@ void PlectrifyEngine::handleListFiles (const juce::var& payload) } #if defined(PLECTRIFY_CONTENT_SOURCE_DIR) - // Debug-only: a pack the repo carries is listed whether it is installed or - // not, so a new one shows up in the drawer without a publish. Outside that - // block (the installed root may not exist at all on a dev machine) and - // deduplicated against it, since an installed pack is already named. + // Debug-only. The listing above is what is installed, and that stays the + // answer: the repo's sources shadow an installed pack's files (see + // resolveSharedFile) but do not add packs, because a pack listed without + // its package installed offers a tile whose plugin, and usually whose + // assets, are not on this machine — every fresh Debug checkout showed the + // repo's whole collection in the drawer with nothing installed (#43). + // Authoring a brand-new pack before its first publish is the one case that + // wants it listed anyway, so that is an explicit opt-in for the session. juce::Array writable; if (payload["root"].toString() == "shared" && payload["dir"].toString().isEmpty()) for (const auto& id : sharedPatchSourceIds()) { if (! dirs.contains (juce::var (id))) + { + if (! listUninstalledPackSources()) + continue; + dirs.add (id); + } // Reported so the page can offer to write one back. Named rather // than implied by a build flag: a pack the repo does not carry is diff --git a/Source/app/PlectrifyEngine.h b/Source/app/PlectrifyEngine.h index 3e8305f..1ff4828 100644 --- a/Source/app/PlectrifyEngine.h +++ b/Source/app/PlectrifyEngine.h @@ -411,6 +411,11 @@ class PlectrifyEngine : private juce::Timer, static juce::File sharedPatchSourceDir (const juce::String& patchId); // The ids those folders offer, for listing the shared root. static juce::StringArray sharedPatchSourceIds(); + // Whether the listing also names packs the repo carries but this machine + // has not installed. Off unless PLECTRIFY_LIST_UNINSTALLED_PACKS=1 is in + // the launch environment: such a pack's plugin and assets are usually not + // here, so by default the sources only shadow packs that are installed. + static bool listUninstalledPackSources(); // The one writable path in this build, and it deliberately does not point // where resolveSharedFile reads from: a write lands in the repo's sources // for the pack, never in the installed copy. Refuses a pack the repo does From 8c207ab84835147970e2176988f77b4f6c62f2d3 Mon Sep 17 00:00:00 2001 From: Patrick Demichiel Date: Tue, 10 Nov 2026 20:41:54 +0100 Subject: [PATCH 2/4] refactor: drop the uninstalled-pack opt-in, keep the listing to what is installed --- AGENTS.md | 22 ++++++---------- Source/app/PlectrifyEngine.cpp | 48 +++++++--------------------------- Source/app/PlectrifyEngine.h | 7 ----- 3 files changed, 17 insertions(+), 60 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 7a93c70..afe6b18 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1861,15 +1861,11 @@ the repo says it is — no `host`, no publish, no install. The override is keyed folder a patch occupies in `patches/` and applies file by file (`MainComponent::sharedPatchSources`), so it reads both shapes `host` ships — the wrapped single patch and a pack of several, whose subfolders install under -their own names. It **shadows packs, it does not add them**: the drawer lists -only what is installed, because a pack listed without its package offers a tile -whose plugin and assets are not on this machine — which is what a fresh Debug -checkout used to show, the repo's whole collection with nothing installed -(issue #43). Authoring a brand-new pack before its first publish is the one -case that wants it listed anyway, so that is an explicit opt-in: -`PLECTRIFY_LIST_UNINSTALLED_PACKS=1` in the launch environment -(`listUninstalledPackSources`). Only this platform's folder is read; the -OS-neutral `content//` shape counts only if it holds a `patch.json`. +their own names. It **shadows installed packs and never adds one**: the drawer +lists only what is installed, since a pack without its package has no plugin to +load (issue #43), so a new pack is installed once before it is edited here. +Only this platform's folder is read; the OS-neutral `content//` shape +counts only if it holds a `patch.json`. **And a Debug build can write those sources back.** A pack patch loaded on a module offers *Update pack source "…"* in the patch menu wherever the repo has @@ -1888,11 +1884,9 @@ Assets are the one thing it cannot shadow, and for the reason the whole folder layout exists: a patch's plugin state names its capture by *absolute installed path*, which nothing here can rewrite. So the edited document is read beside the installed assets — which is the case that matters, since the document is -what is being iterated on — and a pack whose assets have never been installed -loads a patch pointing at files that are not there. Install it once and edit -freely after that. Like the catalogue's bypass this is a compile-time symbol -absent outside Debug, never a setting, and it is read-only exactly like the -root it shadows. +what is being iterated on. Like the catalogue's bypass this is a compile-time +symbol absent outside Debug, never a setting, and it is read-only exactly like +the root it shadows. A folder holding a `patch.json` at its top level *is* a patch, and `host` ships it wrapped in a folder named for the package id — so the repo layout is diff --git a/Source/app/PlectrifyEngine.cpp b/Source/app/PlectrifyEngine.cpp index 769899b..5bb65fd 100644 --- a/Source/app/PlectrifyEngine.cpp +++ b/Source/app/PlectrifyEngine.cpp @@ -2824,21 +2824,6 @@ juce::File PlectrifyEngine::sharedPatchSourceDir (const juce::String& patchId) return found != sources.end() ? found->second : juce::File(); } -juce::StringArray PlectrifyEngine::sharedPatchSourceIds() -{ - juce::StringArray ids; - for (const auto& [id, dir] : sharedPatchSources()) - ids.add (id); - - return ids; -} - -bool PlectrifyEngine::listUninstalledPackSources() -{ - return juce::SystemStats::getEnvironmentVariable ("PLECTRIFY_LIST_UNINSTALLED_PACKS", {}) - .trim() == "1"; -} - bool PlectrifyEngine::resolveSharedSourceFile (const juce::String& rel, juce::File& out) { const auto relative = rel.replaceCharacter ('\\', '/'); @@ -3045,32 +3030,17 @@ void PlectrifyEngine::handleListFiles (const juce::var& payload) } #if defined(PLECTRIFY_CONTENT_SOURCE_DIR) - // Debug-only. The listing above is what is installed, and that stays the - // answer: the repo's sources shadow an installed pack's files (see - // resolveSharedFile) but do not add packs, because a pack listed without - // its package installed offers a tile whose plugin, and usually whose - // assets, are not on this machine — every fresh Debug checkout showed the - // repo's whole collection in the drawer with nothing installed (#43). - // Authoring a brand-new pack before its first publish is the one case that - // wants it listed anyway, so that is an explicit opt-in for the session. + // Debug-only: which listed packs the repo carries sources for, so the + // page can offer to write one back. Only installed packs are listed — the + // sources shadow a pack's files (resolveSharedFile), they never add one. juce::Array writable; if (payload["root"].toString() == "shared" && payload["dir"].toString().isEmpty()) - for (const auto& id : sharedPatchSourceIds()) - { - if (! dirs.contains (juce::var (id))) - { - if (! listUninstalledPackSources()) - continue; - - dirs.add (id); - } - - // Reported so the page can offer to write one back. Named rather - // than implied by a build flag: a pack the repo does not carry is - // read-only even here, so "which are editable" is a fact about - // this machine's source tree and only this side knows it. - writable.add (id); - } + { + const auto sources = sharedPatchSources(); + for (const auto& id : dirs) + if (sources.count (id.toString()) > 0) + writable.add (id); + } #endif auto* r = new juce::DynamicObject(); diff --git a/Source/app/PlectrifyEngine.h b/Source/app/PlectrifyEngine.h index 1ff4828..24b1c37 100644 --- a/Source/app/PlectrifyEngine.h +++ b/Source/app/PlectrifyEngine.h @@ -409,13 +409,6 @@ class PlectrifyEngine : private juce::Timer, // flat and each of its subfolders installs under its own name. static std::map sharedPatchSources(); static juce::File sharedPatchSourceDir (const juce::String& patchId); - // The ids those folders offer, for listing the shared root. - static juce::StringArray sharedPatchSourceIds(); - // Whether the listing also names packs the repo carries but this machine - // has not installed. Off unless PLECTRIFY_LIST_UNINSTALLED_PACKS=1 is in - // the launch environment: such a pack's plugin and assets are usually not - // here, so by default the sources only shadow packs that are installed. - static bool listUninstalledPackSources(); // The one writable path in this build, and it deliberately does not point // where resolveSharedFile reads from: a write lands in the repo's sources // for the pack, never in the installed copy. Refuses a pack the repo does From a86bd0253c915c4a1965cf43b6746b9dca358798 Mon Sep 17 00:00:00 2001 From: Patrick Demichiel Date: Tue, 10 Nov 2026 20:47:49 +0100 Subject: [PATCH 3/4] docs: name the engine as owner and spell out how a new pack reaches a Debug drawer --- AGENTS.md | 9 +++++---- packaging/README.md | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index afe6b18..1a0ce5c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1762,7 +1762,7 @@ An installed patch is an ordinary `kind: "content"` package with plugin opens — patches are Plectrify's own format, so the app has to read them: - **A read-only second root.** `readFile`/`listFiles` take an optional - `root: "shared"` resolved by `MainComponent::resolveSharedFile` against + `root: "shared"` resolved by `PlectrifyEngine::resolveSharedFile` against `%PROGRAMDATA%/Plectrify/patches` alone. `writeFile` and `deleteFile` have no `root` parameter at all, so the page still cannot write outside `%APPDATA%`; scoping to `patches/` rather than the package root also keeps a read-only @@ -1859,12 +1859,13 @@ loop `PLECTRIFY_CATALOGUE_FILE` gives the catalogue: edit `packaging/content/./patch.json`, restart, and the pack is what the repo says it is — no `host`, no publish, no install. The override is keyed by the folder a patch occupies in `patches/` and applies file by file -(`MainComponent::sharedPatchSources`), so it reads both shapes `host` ships — +(`PlectrifyEngine::sharedPatchSources`), so it reads both shapes `host` ships — the wrapped single patch and a pack of several, whose subfolders install under their own names. It **shadows installed packs and never adds one**: the drawer lists only what is installed, since a pack without its package has no plugin to -load (issue #43), so a new pack is installed once before it is edited here. -Only this platform's folder is read; the OS-neutral `content//` shape +load (issue #43). So a new pack, or a new patch in an installed pack, shows up +here after one `host` and one install from the Packages panel — no publish, +since a Debug build reads the repo's catalogue. Only this platform's folder is read; the OS-neutral `content//` shape counts only if it holds a `patch.json`. **And a Debug build can write those sources back.** A pack patch loaded on a diff --git a/packaging/README.md b/packaging/README.md index 88c567d..5c18883 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -117,6 +117,8 @@ pinned to last week's. Add `--dry-run` to see what it would do, or Adding a new patch is a new folder plus a catalogue entry, and a first release keeps the version you wrote (`sha256` of all zeroes means "never published"). +A Debug build's drawer lists only installed packs, so run `host` and install +the package once from the Packages panel before iterating on it there. Give the entry a **`dependsOn`** naming the plugin the patch was built for — one package id, not a list. Installing the patch then installs that plugin From d4c34fa0aea1a73b8da0caae2b0d354254d66dd1 Mon Sep 17 00:00:00 2001 From: Patrick Demichiel Date: Tue, 10 Nov 2026 20:51:20 +0100 Subject: [PATCH 4/4] feat: uninstall every package from the Packages panel in one go --- ui/src/features/plugins/PluginsPanel.svelte | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/ui/src/features/plugins/PluginsPanel.svelte b/ui/src/features/plugins/PluginsPanel.svelte index 4c33edc..321ff21 100644 --- a/ui/src/features/plugins/PluginsPanel.svelte +++ b/ui/src/features/plugins/PluginsPanel.svelte @@ -43,6 +43,7 @@ } from '../../lib/engine/catalogue'; import Button from '../../lib/components/Button.svelte'; import Card from '../../lib/components/Card.svelte'; + import InlineConfirmRow from '../../lib/components/InlineConfirmRow.svelte'; import IconButton from '../../lib/components/IconButton.svelte'; import Popover from '../../lib/components/Popover.svelte'; import RowButton from '../../lib/components/RowButton.svelte'; @@ -343,6 +344,16 @@ engine.uninstallPackages([id]); } + /** Whether "Uninstall all" is waiting on its confirm. */ + let confirmingRemoveAll = $state(false); + + function removeAll(): void { + confirmingRemoveAll = false; + engine.uninstallPackages( + catalogue.items.filter((item) => item.installed).map((item) => item.id), + ); + } + /** The bundle button's one line: the verb, then what it costs. Three cases — never installed, a newer edition published, and the in-between where some of the bundle's plugins are present and the rest are not. @@ -1133,6 +1144,31 @@ {/each} + + {#if expert && installedCount > 0} + {#if confirmingRemoveAll} + (confirmingRemoveAll = false)} + /> + {:else} + + {/if} + {/if} +