05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
67 lines
1.5 KiB
Go
67 lines
1.5 KiB
Go
// Package buildinfo identifies the compiled binary, never the runtime workspace.
|
|
package buildinfo
|
|
|
|
import (
|
|
"runtime/debug"
|
|
"strings"
|
|
)
|
|
|
|
// Docker builds set these through -ldflags because .git is excluded from context.
|
|
var Version string
|
|
var Commit string
|
|
var Dirty string
|
|
|
|
type Info struct {
|
|
Version string `json:"version"`
|
|
Commit string `json:"commit"`
|
|
Dirty *bool `json:"dirty"`
|
|
}
|
|
|
|
func Current() Info {
|
|
build, _ := debug.ReadBuildInfo()
|
|
return resolve(build, Version, Commit, Dirty)
|
|
}
|
|
|
|
func resolve(build *debug.BuildInfo, version, commit, dirty string) Info {
|
|
if build != nil {
|
|
if version == "" && build.Main.Version != "(devel)" {
|
|
version = build.Main.Version
|
|
}
|
|
for _, setting := range build.Settings {
|
|
switch setting.Key {
|
|
case "vcs.revision":
|
|
if commit == "" {
|
|
commit = setting.Value
|
|
}
|
|
case "vcs.modified":
|
|
if dirty == "" {
|
|
dirty = setting.Value
|
|
}
|
|
}
|
|
}
|
|
}
|
|
info := Info{Version: version, Commit: commit}
|
|
if dirty == "true" || dirty == "false" {
|
|
value := dirty == "true"
|
|
info.Dirty = &value
|
|
}
|
|
if info.Version == "" {
|
|
info.Version = "dev"
|
|
if commit != "" && commit != "unknown" {
|
|
short := commit
|
|
if len(short) > 12 {
|
|
short = short[:12]
|
|
}
|
|
info.Version = short
|
|
}
|
|
}
|
|
if info.Dirty != nil && *info.Dirty && !strings.HasSuffix(info.Version, "-dirty") {
|
|
info.Version = strings.TrimSuffix(info.Version, "+dirty")
|
|
info.Version += "-dirty"
|
|
}
|
|
if info.Commit == "" {
|
|
info.Commit = "unknown"
|
|
}
|
|
return info
|
|
}
|