cmd/clide/main.go is the single entry; the same binary will later switch into sidecar-daemon mode via --daemon. internal/cli holds the dispatch (stdlib flag for now, Cobra arrives with the first real subcommand in Tier 2). internal/diag mirrors pql's exit-code contract so the two tools share one mental model for callers. internal/version exposes the build-info struct that the Makefile's -ldflags -X targets stamp; Info() is wired to --version so the binary reports both the declared project.yaml version and the commit it was built from. The daemon, pty, proc, git, ipc, and pql sub-packages ship as doc.go stubs naming the subsystem they will own. They keep the layout legible before the code lands so tier work has a home on arrival. Module path targets Gitea (git.schweitz.net/jpmschweitzer/clide/sidecar), matching where the repo lives. Go module resolution works if the host serves the meta tags; a vanity import path can be added later if needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
907 B
Go
36 lines
907 B
Go
// Package version exposes build-info stamped via -ldflags at build time.
|
|
// See the root Makefile's LDFLAGS for the -X targets.
|
|
package version
|
|
|
|
import "runtime"
|
|
|
|
var (
|
|
Version = "dev"
|
|
Commit = "unknown"
|
|
Date = "unknown"
|
|
)
|
|
|
|
// SchemaVersion tracks the app↔sidecar IPC contract. Bump when the wire
|
|
// format changes in a way that requires coordinated app and sidecar
|
|
// updates. Mirror in project.yaml `schema_version:` when that field is
|
|
// added there.
|
|
const SchemaVersion = 0
|
|
|
|
type BuildInfo struct {
|
|
Version string `json:"version"`
|
|
Commit string `json:"commit"`
|
|
Date string `json:"date"`
|
|
GoVersion string `json:"go_version"`
|
|
SchemaVersion int `json:"schema_version"`
|
|
}
|
|
|
|
func Info() BuildInfo {
|
|
return BuildInfo{
|
|
Version: Version,
|
|
Commit: Commit,
|
|
Date: Date,
|
|
GoVersion: runtime.Version(),
|
|
SchemaVersion: SchemaVersion,
|
|
}
|
|
}
|