Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1859,12 +1859,14 @@ loop `PLECTRIFY_CATALOGUE_FILE` gives the catalogue: edit
`packaging/content/<id>.<platform>/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/<id>/` 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/<id>/` 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
Expand All @@ -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
Expand Down
33 changes: 9 additions & 24 deletions Source/app/PlectrifyEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ('\\', '/');
Expand Down Expand Up @@ -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<juce::var> 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();
Expand Down
2 changes: 0 additions & 2 deletions Source/app/PlectrifyEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ class PlectrifyEngine : private juce::Timer,
// flat and each of its subfolders installs under its own name.
static std::map<juce::String, juce::File> 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
Expand Down
2 changes: 2 additions & 0 deletions packaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions ui/src/features/plugins/PluginsPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1133,6 +1144,31 @@
</Card>
{/each}

<!-- Expert only: emptying the machine in one go is a clean-slate errand, not
something Simple's list of offers needs. -->
{#if expert && installedCount > 0}
{#if confirmingRemoveAll}
<InlineConfirmRow
message={`Uninstall all ${installedCount} packages?`}
confirmLabel="Uninstall all"
onConfirm={removeAll}
onCancel={() => (confirmingRemoveAll = false)}
/>
{:else}
<Button
variant="ghost"
size="sm"
tone="warn"
class="self-start"
disabled={catalogue.busy}
onclick={() => (confirmingRemoveAll = true)}
>
<TrashIcon size={13} aria-hidden="true" />
Uninstall all
</Button>
{/if}
{/if}

<!-- Licence disclosure comes from the catalogue, not from a file in the
installer: change the offered plugins and their notices change with them,
instead of a stale document on disk describing plugins that are no longer
Expand Down
Loading