Skip to content
Merged
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
16 changes: 16 additions & 0 deletions src/Operations/PluginOperations.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Milpa\Command\Effect\Externality;
use Milpa\Command\Effect\Mutation;
use Milpa\Command\Effect\Reversibility;
use Milpa\Command\Effect\Subject;
use Milpa\Command\Operation;
use Milpa\Interfaces\Plugin\PluginInstallerInterface;
use Milpa\Plugin\Contracts\PluginRecord;
Expand Down Expand Up @@ -118,6 +119,7 @@ public function operations(): array
Externality::None,
Reversibility::Guaranteed,
Authority::Read,
subject: Subject::None,
rollbackContract: 'nothing-to-roll-back',
),
description: 'List every installed plugin with its version, type and whether it boots.',
Expand All @@ -142,6 +144,7 @@ public function operations(): array
Externality::None,
Reversibility::Guaranteed,
Authority::Read,
subject: Subject::None,
rollbackContract: 'nothing-to-roll-back',
),
description: 'Everything the registry knows about one plugin.',
Expand All @@ -165,6 +168,7 @@ public function operations(): array
// only level that buys an operation less scrutiny.
Reversibility::Guaranteed,
Authority::WriteAsUser,
subject: Subject::Executable,
rollbackContract: 'plugins.disable',
),
description: 'Turn a plugin on: it boots from the next request or command.',
Expand All @@ -182,6 +186,7 @@ public function operations(): array
Externality::None,
Reversibility::Guaranteed,
Authority::WriteAsUser,
subject: Subject::Executable,
rollbackContract: 'plugins.enable',
),
description: 'Turn a plugin off without removing it or its data.',
Expand Down Expand Up @@ -211,6 +216,7 @@ public function operations(): array
// needed — which is the definition of manual recovery, not of a guarantee.
Reversibility::ManualRecovery,
Authority::Privileged,
subject: Subject::Executable,
),
description: 'Recovery only: turn a plugin off WITHOUT the safety evaluation. May leave this host unable to boot.',
handler: fn (array $input): array => $this->setEnabled($input, false, overridden: true),
Expand Down Expand Up @@ -243,6 +249,7 @@ public function operations(): array
Externality::None,
Reversibility::Guaranteed,
Authority::Read,
subject: Subject::None,
rollbackContract: 'nothing-to-roll-back',
),
description: 'Whether the active plugin graph resolves, and in which order they would boot.',
Expand All @@ -263,6 +270,7 @@ public function operations(): array
Externality::None,
Reversibility::Guaranteed,
Authority::Read,
subject: Subject::None,
rollbackContract: 'nothing-to-roll-back',
),
description: 'The capability graph as data: who provides what, who needs it, what is unsatisfied, and what breaks if you turn a plugin off.',
Expand All @@ -279,6 +287,7 @@ public function operations(): array
Externality::None,
Reversibility::Guaranteed,
Authority::Read,
subject: Subject::None,
rollbackContract: 'nothing-to-roll-back',
),
description: 'What turning a plugin on would do, without turning it on.',
Expand Down Expand Up @@ -318,6 +327,7 @@ public function operations(): array
// operation that would undo it may no longer be reachable.
Reversibility::ManualRecovery,
Authority::Privileged,
subject: Subject::Executable,
),
description: 'Declare a plugin that already exists in this app so the kernel boots it. '
. 'Only for plugin classes already scaffolded under the app tree — never a vendor package.',
Expand All @@ -341,6 +351,7 @@ public function operations(): array
Externality::None,
Reversibility::Guaranteed,
Authority::Read,
subject: Subject::None,
rollbackContract: 'nothing-to-roll-back',
),
description: "Whether a plugin's milpa.json exists, validates, and matches its attribute.",
Expand All @@ -363,6 +374,7 @@ public function operations(): array
// this operation — VCS is the recovery path, and VCS is a human with a terminal.
Reversibility::ManualRecovery,
Authority::WriteAsUser,
subject: Subject::Data,
),
description: 'Regenerate milpa.lock from what the registry says is installed.',
handler: fn (array $input): array => $this->inspection()->lock($input),
Expand Down Expand Up @@ -390,6 +402,7 @@ public function operations(): array
Externality::ThirdParty,
Reversibility::Guaranteed,
Authority::Read,
subject: Subject::None,
rollbackContract: 'nothing-to-roll-back',
),
description: 'Which remotely-installed plugins have a newer version available.',
Expand All @@ -414,6 +427,7 @@ public function operations(): array
Reversibility::ManualRecovery,
// The highest authority in the whole catalogue: it decides what code this app runs.
Authority::Privileged,
subject: Subject::Executable,
escalatesOn: ['source'],
),
description: 'Install a plugin from a source coordinate, e.g. "acme/mail-plugin:^2.0".',
Expand Down Expand Up @@ -454,6 +468,7 @@ public function operations(): array
Externality::ThirdParty,
Reversibility::ManualRecovery,
Authority::Privileged,
subject: Subject::Executable,
escalatesOn: ['name'],
),
description: 'Update an installed plugin to a newer version from the source it came from.',
Expand Down Expand Up @@ -483,6 +498,7 @@ public function operations(): array
// files it created, config it changed. Recovery is a human reading what it touched.
Reversibility::ManualRecovery,
Authority::Privileged,
subject: Subject::Executable,
escalatesOn: ['name'],
),
description: 'Remove an installed plugin, optionally keeping the data it wrote.',
Expand Down
Loading