platform

package
v0.1.0-dev.20260216090256 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package platform provides platform-specific plan bindings for the Starlark runtime.

Each platform (darwin, linux, windows) provides specialized implementations that understand the native package manager, service manager, and file system conventions for that platform.

Build Tags:

  • darwin.go: macOS with Homebrew and launchd
  • linux.go: Linux with runtime distro detection (apt, dnf, pacman)
  • windows.go: Windows with winget

The correct implementation is selected via Go build tags at compile time, with Linux using runtime detection to select the appropriate package manager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinuxPlanBindings

type LinuxPlanBindings struct {
	// contains filtered or unexported fields
}

LinuxPlanBindings provides Linux-specific plan bindings. Uses runtime distro detection to select the appropriate package manager.

func (LinuxPlanBindings) ArchiveExtract

func (b LinuxPlanBindings) ArchiveExtract(archive, target string) *execution.Node

ArchiveExtract adds an archive extraction node.

func (*LinuxPlanBindings) Copy

func (l *LinuxPlanBindings) Copy(source, target string) *execution.Node

Copy adds a file copy node.

func (*LinuxPlanBindings) Decrypt

func (l *LinuxPlanBindings) Decrypt(source string) *execution.Node

Decrypt adds a decryption node.

func (*LinuxPlanBindings) DependsOn

func (l *LinuxPlanBindings) DependsOn(from, to *execution.Node)

DependsOn creates a dependency edge between nodes.

func (LinuxPlanBindings) Download

func (b LinuxPlanBindings) Download(url, target string) *execution.Node

Download adds a file download node.

func (LinuxPlanBindings) GitCheckout

func (b LinuxPlanBindings) GitCheckout(ref string) *execution.Node

GitCheckout adds a git checkout node.

func (LinuxPlanBindings) GitClone

func (b LinuxPlanBindings) GitClone(url, target string) *execution.Node

GitClone adds a git clone node.

func (LinuxPlanBindings) GitPull

func (b LinuxPlanBindings) GitPull() *execution.Node

GitPull adds a git pull node.

func (LinuxPlanBindings) Graph

func (b LinuxPlanBindings) Graph() *execution.Graph

Graph returns the underlying execution graph.

func (LinuxPlanBindings) Host

func (b LinuxPlanBindings) Host() host.Host

Host returns the host abstraction.

func (l *LinuxPlanBindings) Link(source, target string) *execution.Node

Link adds a symlink creation node.

func (*LinuxPlanBindings) PackageInstall

func (l *LinuxPlanBindings) PackageInstall(packages ...string) *execution.Node

PackageInstall adds a package installation node using the platform's package manager.

func (*LinuxPlanBindings) PackageManagerName

func (l *LinuxPlanBindings) PackageManagerName() string

PackageManagerName returns the detected package manager name.

func (*LinuxPlanBindings) PackageRemove

func (l *LinuxPlanBindings) PackageRemove(packages ...string) *execution.Node

PackageRemove adds a package removal node using the platform's package manager.

func (*LinuxPlanBindings) PackageUpdate

func (l *LinuxPlanBindings) PackageUpdate() *execution.Node

PackageUpdate adds a package index update node using the platform's package manager.

func (*LinuxPlanBindings) PackageUpgrade

func (l *LinuxPlanBindings) PackageUpgrade(packages ...string) *execution.Node

PackageUpgrade adds a package upgrade node using the platform's package manager.

func (*LinuxPlanBindings) PlatformName

func (l *LinuxPlanBindings) PlatformName() string

PlatformName returns "linux".

func (LinuxPlanBindings) Project

func (b LinuxPlanBindings) Project() string

Project returns the project name for grouping nodes.

func (LinuxPlanBindings) Remove

func (b LinuxPlanBindings) Remove(target string) *execution.Node

Remove adds a file/directory removal node.

func (*LinuxPlanBindings) Render

func (l *LinuxPlanBindings) Render(source string) *execution.Node

Render adds a template rendering node.

func (*LinuxPlanBindings) Service

func (l *LinuxPlanBindings) Service(name string, action loreStar.ServiceAction) *execution.Node

Service adds a systemd service management node.

func (*LinuxPlanBindings) Shell

func (l *LinuxPlanBindings) Shell(command string) *execution.Node

Shell adds a shell command execution node.

func (*LinuxPlanBindings) ToStarlark

func (l *LinuxPlanBindings) ToStarlark() starlark.Value

ToStarlark converts the plan bindings to a Starlark receiver.

func (*LinuxPlanBindings) Write

func (l *LinuxPlanBindings) Write(target, content string) *execution.Node

Write adds a file write node (write content directly to target).

type PlatformPlanBindings

type PlatformPlanBindings interface {
	loreStar.PlanBindings

	// ToStarlark returns the Starlark representation of the plan bindings.
	ToStarlark() starlark.Value

	// PlatformName returns the platform identifier (e.g., "darwin", "linux", "windows").
	PlatformName() string

	// PackageManagerName returns the package manager name (e.g., "brew", "apt", "winget").
	PackageManagerName() string
}

PlatformPlanBindings extends PlanBindings with platform-specific operations. Each platform implementation may add additional methods beyond the base interface.

func NewPlanBindings

func NewPlanBindings(graph *execution.Graph, h host.Host, project string, reg *execution.ActionRegistry) PlatformPlanBindings

NewPlanBindings creates a new Linux-specific PlanBindings. The appropriate package manager is selected based on the detected distro.

Jump to

Keyboard shortcuts

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