opencodeinstall

package
v1.47.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package opencodeinstall owns the explicit OpenCode notification lifecycle.

Index

Constants

View Source
const (
	OpenCodeDesktop DesktopProduct = iota + 1
	GeminiDesktop
	CopilotVSCodeDesktop
	OpenCodeToastAppID      = "Genius.AgentNotifications.OpenCode"
	GeminiToastAppID        = "Genius.AgentNotifications.Gemini"
	CopilotVSCodeToastAppID = "Genius.AgentNotifications.CopilotVSCode"
	GeminiConsumerID        = "gemini-notifications"
)

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, r Request) error

func ChannelsFromSnapshot

func ChannelsFromSnapshot(s installruntime.PolicySnapshot, executable, goos, goarch string) (bool, bool)

ChannelsFromSnapshot validates OpenCode ownership and explicit consent in an already-read policy snapshot. It is safe to use inside a setup/native lease callback after the caller revalidates that snapshot under the component lock.

func PrepareNativeSpool

func PrepareNativeSpool(context.Context, string) (string, error)

func PrepareNativeSpoolFor added in v1.47.0

func PrepareNativeSpoolFor(context.Context, string, DesktopProduct) (string, error)

func RegisteredFromSnapshot

func RegisteredFromSnapshot(s installruntime.PolicySnapshot, executable, goos, goarch string) bool

RegisteredFromSnapshot checks the owned OpenCode command without requiring desktop consent, so explicit permission setup can precede channel enablement.

func RevokeChannels

func RevokeChannels(ctx context.Context, controlRoot, runtimeRoot string) error

RevokeChannels turns off only OpenCode's two channel consents. It is the first removal step and remains available when a delivery asset is missing or damaged; cleanup may report its own conflict afterward.

func SetupPermission

func SetupPermission(context.Context, string, bool) (string, error)

func StageWindowsShortcut added in v1.47.0

func WindowsShortcutReadyFor added in v1.47.0

func WindowsShortcutReadyFor(DesktopProduct, string, string) error

Types

type Action

type Action string
const (
	Install Action = "install"
	Update  Action = "update"
	Remove  Action = "remove"
	Recover Action = "recover"
)

type CurrentGate

type CurrentGate struct{ ControlRoot, Executable, GOOS, GOARCH string }

CurrentGate reads the product registration on each event. No recovery or config mutation occurs on this observation path.

func (CurrentGate) Channels

func (g CurrentGate) Channels(ctx context.Context) (bool, bool)

func (CurrentGate) Enabled

func (g CurrentGate) Enabled(ctx context.Context) bool

type DesktopProduct added in v1.47.0

type DesktopProduct uint8

DesktopProduct selects an installer-owned observer identity. Config and native event data cannot supply an AUMID, shortcut or namespace.

type Request

type Request struct {
	Action                                    Action
	ControlRoot, RuntimeRoot, BinarySource    string
	NativeSource                              string
	HomeDir, XDGConfigHome, OpenCodeConfigDir string
	Desktop, Webhook                          bool
	// Platform is supplied by the CLI. Tests use disposable platform fixtures.
	GOOS, GOARCH string
}

func DefaultRequest

func DefaultRequest(action Action) Request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL