installer

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package installer provides installation and management for git-courer.

Package installer provides installation and management for git-courer.

Package installer provides installation and management for git-courer.

Package installer provides installation and management for git-courer.

Package installer provides installation and management for git-courer.

Index

Constants

View Source
const (
	// BinaryName is the name of the binary.
	BinaryName = "git-courer"
	// Owner is the GitHub owner.
	Owner = "Alejandro-M-P"
	// Repo is the GitHub repository.
	Repo = "git-courer"
)
View Source
const (
	// PostInstallEnv is the env var that triggers post-install setup.
	PostInstallEnv = "GIT_COURER_POSTINSTALL"
)

Variables

This section is empty.

Functions

func CheckForUpdates

func CheckForUpdates() (bool, string, error)

CheckForUpdates checks if a new version is available using go-selfupdate. Uses GitHub source with platform-specific filter regex to match assets like git-courer_{version}_{OS}_{Arch}.tar.gz

func ConfigureAllMCP

func ConfigureAllMCP(binPath string) (int, error)

ConfigureAllMCP configures git-courer for all detected MCP clients.

func ConfigureMCP

func ConfigureMCP(client *MCPClient, binPath string) error

ConfigureMCP configures git-courer for the given MCP client.

func DownloadUpdate

func DownloadUpdate() error

DownloadUpdate downloads and installs the latest version using go-selfupdate. Relies on go-selfupdate's UpdateTo() which handles download, extraction, and binary replacement atomically. Post-update steps (MCP reconfiguration and rule file updates) only execute after successful binary replacement.

func FetchVersion

func FetchVersion() (string, error)

FetchVersion fetches the current version from the binary.

func FindBinaryPath

func FindBinaryPath() (string, error)

FindBinaryPath tries to find the git-courer binary path.

func RemoveProject

func RemoveProject(projectDir string) error

RemoveProject removes git-courer from a project directory.

func RunPostInstall added in v1.4.2

func RunPostInstall() error

RunPostInstall runs setup after go install. Called when GIT_COURER_POSTINSTALL=1 is set.

func RunRemove

func RunRemove(projectDir string) error

RunRemove removes git-courer from a project.

func RunSetup

func RunSetup(projectDir string) error

RunSetup runs project setup.

func RunUninstall

func RunUninstall() error

RunUninstall performs global uninstall.

func RunUpdate

func RunUpdate(force bool) error

RunUpdate checks for and applies updates.

func SetupClient

func SetupClient(clientName, binPath string) error

SetupClient sets up git-courer for a specific client.

func SetupHooks

func SetupHooks(projectDir string) error

SetupHooks creates git hooks in the project's .git/hooks directory.

func SetupProject

func SetupProject(projectDir string) error

SetupProject sets up git-courer in a project directory.

func WriteRuleFiles added in v1.4.2

func WriteRuleFiles(binPath string) (int, error)

WriteRuleFiles writes agent rule files to the filesystem. It creates CLAUDE.md, .cursorrules, opencode skill, etc. If a file exists, it merges: keeps user customizations + adds new default content.

Types

type MCPClient

type MCPClient struct {
	Name     string
	Filename string // config filename
	RootKey  string // mcpServers, mcp, servers, context_servers
	IsArray  bool   // continue uses array format
	ConfigFn func(binPath string) map[string]interface{}
	Paths    []string // possible config file paths for this platform
	Detect   func() bool
}

MCPClient represents an MCP client configuration.

func DetectClients

func DetectClients() []*MCPClient

DetectClients returns a list of detected MCP clients on the system.

func MCPClients

func MCPClients() []*MCPClient

MCPClients returns all supported MCP clients.

type MCPServerConfig

type MCPServerConfig struct {
	Command string   `json:"command,omitempty"`
	Args    []string `json:"args,omitempty"`
	Type    string   `json:"type,omitempty"`
}

MCPServerConfig represents an MCP server entry.

type OS

type OS string

OS represents a supported operating system.

const (
	OSLinux   OS = "linux"
	OSMacOS   OS = "darwin"
	OSWindows OS = "windows"
)

type Platform

type Platform struct {
	OS      OS
	Arch    string
	Version string
}

Platform represents the current platform.

func Detect

func Detect() *Platform

Detect returns the current platform.

func (*Platform) BinaryName

func (p *Platform) BinaryName() string

BinaryName returns the binary name for this platform.

func (*Platform) GitHubAsset

func (p *Platform) GitHubAsset() string

GitHubAsset returns the partial GitHub asset name (without version). Assets are named like: git-courer_1.0.1_darwin_arm64.tar.gz

func (*Platform) String

func (p *Platform) String() string

String returns a string representation of the platform.

type Release

type Release struct {
	TagName string
	Assets  []ReleaseAsset
}

Release represents a GitHub release.

func FetchLatestRelease

func FetchLatestRelease(owner, repo string) (*Release, error)

FetchLatestRelease fetches the latest release from GitHub (stub implementation).

func (*Release) FindAsset

func (r *Release) FindAsset(platform *Platform) *ReleaseAsset

FindAsset finds an asset matching the platform.

type ReleaseAsset added in v1.4.2

type ReleaseAsset struct {
	Name string
	URL  string
}

ReleaseAsset represents a GitHub release asset.

func (*ReleaseAsset) DownloadAsset added in v1.4.2

func (a *ReleaseAsset) DownloadAsset(dest string) error

DownloadAsset downloads the asset to a local path.

type RuleFile

type RuleFile struct {
	Name    string
	Path    string
	Content string
}

RuleFile represents an agent's instruction/rules file.

func GetRuleFiles

func GetRuleFiles(binPath string) ([]RuleFile, error)

GetRuleFiles returns the rule files to create for all agents.

type UpdaterFactory added in v1.4.2

type UpdaterFactory func() (*selfupdate.Updater, error)

UpdaterFactory defines a factory for creating selfupdate.Updater instances. Used for dependency injection in tests.

Jump to

Keyboard shortcuts

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