diff --git a/AGENTS.md b/AGENTS.md index c1be544..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,14 @@ 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. 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 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, 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 module offers *Update pack source "…"* in the patch menu wherever the repo has @@ -1883,11 +1885,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 01cf171..5bb65fd 100644 --- a/Source/app/PlectrifyEngine.cpp +++ b/Source/app/PlectrifyEngine.cpp @@ -2824,15 +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::resolveSharedSourceFile (const juce::String& rel, juce::File& out) { const auto relative = rel.replaceCharacter ('\\', '/'); @@ -3039,23 +3030,17 @@ 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: 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))) - 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 3e8305f..24b1c37 100644 --- a/Source/app/PlectrifyEngine.h +++ b/Source/app/PlectrifyEngine.h @@ -409,8 +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(); // 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 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 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} +