tools

package
v0.11.10 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package tools provides utilities for managing external tools used by Fuego.

Package tools provides utility functions for the Fuego CLI.

Index

Constants

View Source
const (
	// TailwindVersion is the version of Tailwind CSS to use
	TailwindVersion = "4.0.0"

	// DefaultCacheDir is the default cache directory for tools
	DefaultCacheDir = ".cache/fuego/bin"
)
View Source
const (
	GitHubOwner        = "abdul-hamid-achik"
	GitHubRepo         = "fuego"
	ReleasesAPIURL     = "https://api.github.com/repos/%s/%s/releases"
	CheckIntervalHours = 24 // Cache update check for 24h
)

Constants for the update system

Variables

This section is empty.

Functions

func CompareVersions added in v0.9.1

func CompareVersions(v1, v2 string) int

CompareVersions compares two semantic versions Returns: -1 if v1 < v2, 0 if equal, 1 if v1 > v2 Handles "dev" as always being older than any release

func DefaultInputPath

func DefaultInputPath() string

DefaultInputPath returns the default input CSS path

func DefaultOutputPath

func DefaultOutputPath() string

DefaultOutputPath returns the default output CSS path

func HasStyles

func HasStyles() bool

HasStyles checks if the project has a styles directory with input.css

func HasStylesIn

func HasStylesIn(dir string) bool

HasStylesIn checks if the project has a styles directory with input.css in a specific directory

func NeedsInitialBuild

func NeedsInitialBuild() bool

NeedsInitialBuild checks if output.css needs to be built

Types

type Asset added in v0.9.1

type Asset struct {
	Name        string `json:"name"`
	DownloadURL string `json:"browser_download_url"`
	Size        int64  `json:"size"`
}

Asset represents a release asset

type ReleaseInfo added in v0.9.1

type ReleaseInfo struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	Body        string    `json:"body"` // Release notes
	Draft       bool      `json:"draft"`
	Prerelease  bool      `json:"prerelease"`
	PublishedAt time.Time `json:"published_at"`
	Assets      []Asset   `json:"assets"`
}

ReleaseInfo represents a GitHub release

type TailwindCLI

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

TailwindCLI manages the Tailwind CSS standalone binary

func NewTailwindCLI

func NewTailwindCLI() *TailwindCLI

NewTailwindCLI creates a new TailwindCLI manager

func NewTailwindCLIWithCacheDir

func NewTailwindCLIWithCacheDir(cacheDir string) *TailwindCLI

NewTailwindCLIWithCacheDir creates a TailwindCLI with a custom cache directory

func (*TailwindCLI) BinaryPath

func (t *TailwindCLI) BinaryPath() string

BinaryPath returns the path to the Tailwind binary

func (*TailwindCLI) Build

func (t *TailwindCLI) Build(input, output string) error

Build runs Tailwind to compile CSS

func (*TailwindCLI) BuildWithOutput

func (t *TailwindCLI) BuildWithOutput(input, output string) (string, error)

BuildWithOutput runs Tailwind and captures output

func (*TailwindCLI) CacheDir

func (t *TailwindCLI) CacheDir() string

CacheDir returns the cache directory

func (*TailwindCLI) EnsureInstalled

func (t *TailwindCLI) EnsureInstalled() error

EnsureInstalled downloads Tailwind if not already present

func (*TailwindCLI) GetTailwindVersion

func (t *TailwindCLI) GetTailwindVersion() (string, error)

GetTailwindVersion attempts to get the version of an installed Tailwind binary

func (*TailwindCLI) IsInstalled

func (t *TailwindCLI) IsInstalled() bool

IsInstalled checks if Tailwind is already installed

func (*TailwindCLI) Version

func (t *TailwindCLI) Version() string

Version returns the Tailwind version

func (*TailwindCLI) Watch

func (t *TailwindCLI) Watch(input, output string) (*exec.Cmd, error)

Watch runs Tailwind in watch mode and returns the process. It first runs an initial build to ensure CSS is up-to-date, then starts watching.

type Updater added in v0.9.1

type Updater struct {
	CurrentVersion    string
	IncludePrerelease bool
	// contains filtered or unexported fields
}

Updater handles self-updates for the Fuego CLI

func NewUpdater added in v0.9.1

func NewUpdater() *Updater

NewUpdater creates a new Updater instance

func (*Updater) BackupCurrent added in v0.9.1

func (u *Updater) BackupCurrent() error

BackupCurrent backs up the current binary before replacement

func (*Updater) BackupPath added in v0.9.1

func (u *Updater) BackupPath() string

BackupPath returns the path to the backup binary

func (*Updater) CacheDir added in v0.9.1

func (u *Updater) CacheDir() string

CacheDir returns the cache directory path (~/.cache/fuego)

func (*Updater) CheckForUpdate added in v0.9.1

func (u *Updater) CheckForUpdate() (*ReleaseInfo, bool, error)

CheckForUpdate checks GitHub for newer releases Returns: (latestRelease, hasUpdate, error)

func (*Updater) Download added in v0.9.1

func (u *Updater) Download(asset *Asset) (string, error)

Download downloads the release asset to a temp file Returns the path to the downloaded archive

func (*Updater) ExtractBinary added in v0.9.1

func (u *Updater) ExtractBinary(archivePath string) (string, error)

ExtractBinary extracts the fuego binary from the downloaded archive Returns the path to the extracted binary

func (*Updater) GetAssetForPlatform added in v0.9.1

func (u *Updater) GetAssetForPlatform(release *ReleaseInfo) (*Asset, error)

GetAssetForPlatform finds the correct asset for current OS/arch

func (*Updater) GetBackupVersion added in v0.9.1

func (u *Updater) GetBackupVersion() string

GetBackupVersion tries to get the version of the backup binary

func (*Updater) GetLatestRelease added in v0.9.1

func (u *Updater) GetLatestRelease() (*ReleaseInfo, error)

GetLatestRelease fetches the latest release (for direct calls)

func (*Updater) GetSpecificRelease added in v0.9.1

func (u *Updater) GetSpecificRelease(targetVersion string) (*ReleaseInfo, error)

GetSpecificRelease fetches a specific version

func (*Updater) HasBackup added in v0.9.1

func (u *Updater) HasBackup() bool

HasBackup returns true if a backup exists

func (*Updater) Install added in v0.9.1

func (u *Updater) Install(newBinaryPath string) error

Install installs the new binary, replacing the current one

func (*Updater) LastCheckPath added in v0.9.1

func (u *Updater) LastCheckPath() string

LastCheckPath returns the path to the last check timestamp file

func (*Updater) Rollback added in v0.9.1

func (u *Updater) Rollback() error

Rollback restores the backup binary

func (*Updater) SaveLastCheckTime added in v0.9.1

func (u *Updater) SaveLastCheckTime() error

SaveLastCheckTime saves the current time as last check

func (*Updater) ShouldCheckForUpdate added in v0.9.1

func (u *Updater) ShouldCheckForUpdate() bool

ShouldCheckForUpdate returns true if enough time has passed since last check

func (*Updater) VerifyChecksum added in v0.9.1

func (u *Updater) VerifyChecksum(archivePath string, release *ReleaseInfo) error

VerifyChecksum verifies the downloaded archive against checksums.txt

Jump to

Keyboard shortcuts

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