mise

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mise bootstraps the mise binary and runs mise operations.

Index

Constants

View Source
const InstallerURL = "https://mise.run"

InstallerURL is the official mise installer.

View Source
const MinMiseVersion = "2025.1.0"

MinMiseVersion is the hardcoded minimum mise version required by dotdrift.

Variables

This section is empty.

Functions

func CompareVersions

func CompareVersions(a, b string) int

CompareVersions compares calendar-style versions like 2026.6.6. Returns -1 if a < b, 0 if equal, 1 if a > b.

func GenerateConfig

func GenerateConfig(plan *resolve.Plan) string

GenerateConfig emits a complete mise.toml with tools and dotfiles sections.

func GenerateDotfiles

func GenerateDotfiles(entries []resolve.DotfileEntry) string

GenerateDotfiles emits a mise.toml [dotfiles] section from the resolved plan.

func GenerateTools

func GenerateTools(versions map[string]string) string

GenerateTools emits a mise.toml [tools] section from the resolved plan.

Types

type DotfileEntry

type DotfileEntry struct {
	Target string
	Source string
	Mode   string
	Module string
	Layer  string
}

DotfileEntry is a single resolved dotfile target.

type DotfilesStep

type DotfilesStep struct {
	Runner     Runner
	Plan       *resolve.Plan
	ConfigPath string
	Yes        bool
}

DotfilesStep runs mise dotfiles apply for the dotfiles in the resolved plan.

func (*DotfilesStep) Name

func (s *DotfilesStep) Name() string

func (*DotfilesStep) Run

func (s *DotfilesStep) Run(ctx context.Context) error

type ExecMise

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

ExecMise wraps a Mise value so it can be used as a Runner by step code.

func NewExecMise

func NewExecMise(m *Mise) *ExecMise

NewExecMise creates a Runner backed by a Mise instance.

func (*ExecMise) DotfilesApply

func (e *ExecMise) DotfilesApply(configPath string, yes bool) error

func (*ExecMise) EnsureAndInstall

func (e *ExecMise) EnsureAndInstall(configPath string) error

type FakeRunner

type FakeRunner struct {
	InstallCalled  bool
	DotfilesCalled bool
	Yes            bool
	Err            error
}

FakeRunner records mise invocations for tests.

func (*FakeRunner) DotfilesApply

func (f *FakeRunner) DotfilesApply(configPath string, yes bool) error

func (*FakeRunner) EnsureAndInstall

func (f *FakeRunner) EnsureAndInstall(configPath string) error

type HooksStep

type HooksStep struct{}

HooksStep is a placeholder for pre/post hooks in v0.1.

func (*HooksStep) Name

func (s *HooksStep) Name() string

func (*HooksStep) Run

func (s *HooksStep) Run(ctx context.Context) error

type InstallKind

type InstallKind int

InstallKind classifies how a mise binary is managed.

const (
	InstallKindUnknown InstallKind = iota
	InstallKindSystemWide
	InstallKindUserManaged
)

func ClassifyInstall

func ClassifyInstall(path string) InstallKind

ClassifyInstall determines whether a mise binary is system-wide or user-managed.

System-wide (no auto-upgrade):

  • DOTDRIFT_MISE_SYSTEM=1
  • path under /usr/bin, /usr/local/bin, /bin, /sbin, /usr/sbin, /opt
  • path under $HOME but not writable by the current user

User-managed (may auto-upgrade):

  • path under $HOME and writable by the current user

func (InstallKind) String

func (k InstallKind) String() string

type Mise

type Mise struct {
	LookPath func(string) (string, error)
	Run      func(string, ...string) (string, error)
	Install  func() (string, error)
	Classify func(string) InstallKind
}

Mise finds, installs, or upgrades a mise binary.

func DefaultMise

func DefaultMise() *Mise

DefaultMise returns a Mise configured with real OS dependencies.

func (*Mise) Ensure

func (m *Mise) Ensure() (string, error)

Ensure finds or installs a mise binary meeting the minimum version.

type Plan

type Plan struct {
	Tools    map[string]string
	Dotfiles []DotfileEntry
}

Plan mirrors the parts of resolve.Plan needed for mise config generation.

type Runner

type Runner interface {
	EnsureAndInstall(configPath string) error
	DotfilesApply(configPath string, yes bool) error
}

Runner abstracts mise operations used by apply steps.

type ToolsStep

type ToolsStep struct {
	Runner     Runner
	Plan       *resolve.Plan
	ConfigPath string
}

ToolsStep runs mise install for the tools in the resolved plan.

func (*ToolsStep) Name

func (s *ToolsStep) Name() string

func (*ToolsStep) Run

func (s *ToolsStep) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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