update

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package update probes GitHub for new commits on the bee main branch and applies updates by re-running install.sh in a subprocess.

Used by the TUI background-checker goroutine. Two pieces are deliberately separated:

  • Probe — cheap HTTP call, no side effects, safe to run on a timer.
  • Apply — spawns the installer subprocess; only invoked from a user decision in the modal.

Index

Constants

View Source
const InstallURL = "https://raw.githubusercontent.com/elhenro/bee/main/install.sh"

InstallURL is the canonical curl-piped installer script.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context) ([]byte, error)

Apply runs the installer in a subprocess and returns its combined output. The installer auto-detects platform, downloads the latest binary, and installs over the current bee binary. Sudo is required when the install dir isn't writable — this call will FAIL in that case (no tty available inside the TUI), and the caller is expected to surface a "run manually" hint with the same curl command shown in InstallCommand.

func InstallCommand

func InstallCommand() string

InstallCommand returns the shell one-liner the user can paste outside bee when Apply fails (e.g. because /usr/local/bin needs sudo).

Types

type Info

type Info struct {
	CurrentSHA string // build-time commit (short or full)
	LatestSHA  string // full sha of branch HEAD
	ShortSHA   string // 7-char short of LatestSHA
	Ahead      int    // commits in main not in current
	Behind     int    // commits in current not in main (forks / dirty builds)
	Repo       string // owner/repo (e.g. elhenro/bee)
	Branch     string // e.g. main
}

Info describes an update opportunity returned by Probe.

func Probe

func Probe(ctx context.Context, repo, branch, currentSHA string) (Info, error)

Probe asks GitHub how far the current build's commit is behind branch HEAD. currentSHA can be a short or full hash. Empty currentSHA or "dev" yields the zero Info — dev builds don't get update prompts.

func (Info) Available

func (i Info) Available() bool

Available reports whether main has commits the current build doesn't.

Jump to

Keyboard shortcuts

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