setup

package
v0.0.0-...-746c939 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 8 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 (
	// DataKeyDryRun is the context Data key for dry-run mode.
	DataKeyDryRun = "dry_run"

	// DataKeyConfig is the context Data key for the unified config.
	DataKeyConfig = "config"
)

Context Data keys.

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.

+devlore:access=immediate

func NewProvider

func NewProvider(ctx op.Context) *Provider

NewProvider creates a setup provider bound to the given context.

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