setup

package
v0.1.0-dev.20260827011101 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package setup provides repository setup operations: tool checks, pre-commit hooks, config initialization, and native git hook management.

Index

Constants

View Source
const (
	CheckHook        op.ActionName = "setup.check_hook"
	InitConfig       op.ActionName = "setup.init_config"
	InstallHook      op.ActionName = "setup.install_hook"
	PrecommitCheck   op.ActionName = "setup.precommit_check"
	PrecommitInstall op.ActionName = "setup.precommit_install"
	Tools            op.ActionName = "setup.tools"
	UninstallHook    op.ActionName = "setup.uninstall_hook"
)

Action-name constants for the setup provider's plan-mode actions.

Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type HookCheckResult

type HookCheckResult struct {
	Installed     bool `starlark:"installed"`
	Exists        bool `starlark:"exists"`
	ManagedByStar bool `starlark:"managed_by_star"`
}

HookCheckResult holds the status of a git hook.

type HookInstallResult

type HookInstallResult struct {
	Success          bool   `starlark:"success"`
	Message          string `starlark:"message"`
	AlreadyInstalled bool   `starlark:"already_installed"`
}

HookInstallResult holds the outcome of a hook install or uninstall.

type HookUninstallResult

type HookUninstallResult struct {
	Success bool   `starlark:"success"`
	Message string `starlark:"message"`
}

HookUninstallResult holds the outcome of a hook uninstall.

type InitConfigResult

type InitConfigResult struct {
	ConfigCreated bool     `starlark:"config_created"`
	ConfigPath    string   `starlark:"config_path"`
	ConfigsSynced []string `starlark:"configs_synced"`
}

InitConfigResult holds the outcome of config initialization.

type PrecommitCheckResult

type PrecommitCheckResult struct {
	Installed          bool   `starlark:"installed"`
	ConfigExists       bool   `starlark:"config_exists"`
	PrecommitAvailable bool   `starlark:"precommit_available"`
	PrecommitPath      string `starlark:"precommit_path"`
}

PrecommitCheckResult holds pre-commit hook status.

type PrecommitInstallResult

type PrecommitInstallResult struct {
	Success          bool   `starlark:"success"`
	Message          string `starlark:"message"`
	AlreadyInstalled bool   `starlark:"already_installed"`
}

PrecommitInstallResult holds the outcome of a pre-commit install.

type Provider

type Provider struct {
	op.ProviderBase
}

Provider provides repository setup operations.

func NewProvider

func NewProvider(ctx *op.RuntimeEnvironment) *Provider

NewProvider creates a setup provider bound to the given context. Declares interest in the "config" variable so the resolver populates it from the [application.Application]'s source maps at construction time. Dry-run is read via [op.RuntimeEnvironment.Application.DryRun] — no parameter declaration needed.

func (*Provider) CheckHook

func (p *Provider) CheckHook(name string) (HookCheckResult, error)

CheckHook checks the status of a git hook.

Parameters:

  • name: hook name to check

Returns:

  • HookCheckResult: existence and management status
  • error: if read fails

func (*Provider) InitConfig

func (p *Provider) InitConfig() (InitConfigResult, error)

InitConfig creates star/config.yaml and syncs tool configs.

Returns:

  • InitConfigResult: config creation status and synced files
  • error: if config creation or sync fails

func (*Provider) InstallHook

func (p *Provider) InstallHook(name string) (HookInstallResult, error)

InstallHook installs a native git hook managed by star.

Parameters:

  • name: hook name (pre-commit, pre-push, commit-msg, post-commit)

Returns:

  • HookInstallResult: success/failure and message
  • error: if hook name is invalid or write fails

func (*Provider) PrecommitCheck

func (p *Provider) PrecommitCheck() (PrecommitCheckResult, error)

PrecommitCheck checks whether pre-commit hooks are installed.

Returns:

  • PrecommitCheckResult: hook installation status
  • error: never

func (*Provider) PrecommitInstall

func (p *Provider) PrecommitInstall() (PrecommitInstallResult, error)

PrecommitInstall installs pre-commit hooks.

Returns:

  • PrecommitInstallResult: success/failure and message
  • error: if pre-commit execution fails

func (*Provider) Tools

func (p *Provider) Tools() (ToolsResult, error)

Tools checks whether required development tools are installed.

Returns:

  • ToolsResult: installation status of each tool
  • error: never

func (*Provider) UninstallHook

func (p *Provider) UninstallHook(name string) (HookUninstallResult, error)

UninstallHook removes a star-managed git hook.

Parameters:

  • name: hook name to remove

Returns:

  • HookUninstallResult: success/failure and message
  • error: if read/remove fails

type ToolStatus

type ToolStatus struct {
	Name        string            `starlark:"name"`
	Binary      string            `starlark:"binary"`
	Description string            `starlark:"description"`
	DocsURL     string            `starlark:"docs_url"`
	Installed   bool              `starlark:"installed"`
	Path        string            `starlark:"path"`
	Install     map[string]string `starlark:"install"`
	InstallCmd  string            `starlark:"install_cmd"`
}

ToolStatus represents the installation status of a single tool.

type ToolsResult

type ToolsResult struct {
	Tools        []ToolStatus `starlark:"tools"`
	AllInstalled bool         `starlark:"all_installed"`
	MissingCount int          `starlark:"missing_count"`
	Platform     string       `starlark:"platform"`
}

ToolsResult holds the outcome of a tool availability check.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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