Documentation
¶
Index ¶
Constants ¶
const DefaultAIDir = ".hamr/ai"
DefaultAIDir is the default directory for AI command artifacts.
const DefaultLatestReleaseTimeout = 3 * time.Second
DefaultLatestReleaseTimeout is the default network timeout for FetchLatestRelease.
const HamrRepoURL = "https://github.com/FyrmForge/hamr.git"
HamrRepoURL is the default repository URL for diffing scaffold changes.
Variables ¶
This section is empty.
Functions ¶
func ResolveAIDir ¶
ResolveAIDir loads metadata from tomlPath and returns the AI directory. Falls back to DefaultAIDir on any error, logging a warning when the file exists but cannot be parsed.
func UpdateVersion ¶
UpdateVersion reads hamr.toml, replaces the version value under [hamr], and writes back. Uses line-level replacement to preserve comments and formatting. The original file is restored if verification fails.
Types ¶
type AIConfig ¶
type AIConfig struct {
Dir string `toml:"dir"`
}
AIConfig holds the [ai] section of hamr.toml.
type DiffProjectInfo ¶
type DiffProjectInfo struct {
BaseVersion string `json:"base_version"`
CurrentVersion string `json:"current_version"`
ScaffoldedAt string `json:"scaffolded_at,omitempty"`
Options Options `json:"options"`
}
DiffProjectInfo describes the project's scaffold state for a diff report.
type DiffReport ¶
type DiffReport struct {
Project DiffProjectInfo `json:"project"`
Diff string `json:"diff"`
DiffStat string `json:"diff_stat"`
}
DiffReport is the structured output of the git-based upgrade command.
func GitDiff ¶
func GitDiff(ctx context.Context, repoURL, baseVersion, currentVersion string) (*DiffReport, error)
GitDiff clones the given repo (bare, partial) and produces a unified diff between two version tags. The repoURL parameter allows tests to pass a local repository path instead of hitting the network.
type HamrSection ¶
type HamrSection struct {
Version string `toml:"version"`
ScaffoldedAt string `toml:"scaffolded_at"`
}
HamrSection holds the HAMR scaffold tracking fields.
type LocaleSection ¶
type LocaleSection struct {
Default string `toml:"default"`
}
LocaleSection holds the [locale] table fields the CLI reads.
type Metadata ¶
type Metadata struct {
Hamr HamrSection `toml:"hamr"`
Options Options `toml:"options"`
AI AIConfig `toml:"ai"`
Locale LocaleSection `toml:"locale"`
}
Metadata represents the [hamr], [options], [ai], and [locale] sections of hamr.toml.
func LoadMetadata ¶
LoadMetadata reads hamr.toml and decodes the [hamr] and [options] sections. Returns zero Metadata (with empty version) when [hamr] is absent.
func (Metadata) HasHamrSection ¶
HasHamrSection reports whether the loaded metadata contained a [hamr] section. When false, the project was scaffolded before metadata tracking was added.
type Options ¶
type Options struct {
Database string `toml:"database"`
DBConnector string `toml:"db_connector"`
Auth string `toml:"auth"`
CSS string `toml:"css"`
WebSockets bool `toml:"websockets"`
E2E bool `toml:"e2e"`
Stripe bool `toml:"stripe"`
Locale bool `toml:"locale"`
Storage string `toml:"storage"`
Alpine bool `toml:"alpine"`
}
Options records the scaffold choices made when the project was generated.
type Version ¶
Version represents a semantic version with major, minor, and patch components.
func FetchLatestRelease ¶
FetchLatestRelease queries GitHub for the most recent hamr release and returns the parsed version. The supplied context bounds the request; a timeout shorter than DefaultLatestReleaseTimeout is recommended for interactive commands so users are not left hanging on network issues.
func ParseVersion ¶
ParseVersion parses a version string like "v0.3.2", "0.3.2", or "0.3.2-dev" into a Version. Pre-release suffixes ("-dev", "-rc.1") and SemVer build metadata ("+build.42") are both stripped.