Files
Reims-Go/internal/macos/guest/install_guide.go
T
Nwflower 5cbd7bceac feat(plugins): move macOS support into builtin.guest.macos
Declare the reims guest driver statically, merge the install guide into the optional macOS plugin, and keep compatibility settings under the new owner.

Add data layout v2 with atomic state migration, ledger backups, targeted argument ownership moves, and idempotent v1 upgrade coverage. Reduce builtin.core to the default theme.

Add a reverse import ratchet for internal/macos and document the transition. The macOS plugin remains enabled by default during migration; that default and the future privilege/trust rules remain subject to review.
2026-11-30 07:20:15 -07:00

35 lines
1.2 KiB
Go

package guest
import (
"context"
"github.com/Nwflower/reims-go/internal/macos/installguide"
"github.com/Nwflower/reims-go/internal/plugin"
"github.com/Nwflower/reims-go/internal/plugin/builtin"
)
// LegacyInstallGuideID was the standalone plugin merged into the macOS guest.
const LegacyInstallGuideID = "builtin.install-guide"
// ServiceInstallGuide remains stable for host and third-party consumers.
const ServiceInstallGuide = "ui.install-guide"
func activateInstallGuide(_ context.Context, sc *plugin.Scope, cb builtin.HostCallbacks) {
mgr := installguide.NewManager(cb.OnInstallGuidesChanged)
sc.Provide(ServiceInstallGuide, "1.0.0", mgr)
sc.OnDispose(mgr.Close)
hooks := sc.Registry().Hooks()
cancelVM := func(_ context.Context, raw any) (any, error) {
if ev, ok := raw.(plugin.VMEventPayload); ok && ev.VMName != "" {
mgr.Cancel(ev.VMName)
}
return nil, nil
}
hooks.Subscribe(sc, plugin.HookRegistration{Event: plugin.EventVMAfterStop, Builtin: true, Handler: cancelVM})
hooks.Subscribe(sc, plugin.HookRegistration{Event: plugin.EventVMDeleted, Builtin: true, Handler: cancelVM})
if cb.SyncInstallGuides != nil {
cb.SyncInstallGuides()
}
}