Add runtime version reporting

This commit is contained in:
2026-10-05 16:49:54 +00:00
parent 9e855c81a6
commit d692607e2b
11 changed files with 292 additions and 9 deletions

View File

@@ -42,10 +42,10 @@ Run the offline Go test suite from the repository root with:
go test ./...
```
The implemented package inventory currently contains only the root
`releasekit` facade package. Its public operations are added as their behavior is
implemented; see the [implementation plan](roadmap/implementation.md) for
current progress.
The implemented package inventory currently contains the root `releasekit`
facade and `buildinfo` runtime facade, plus the `cmd/releasekit` executable.
Orchestration operations are added as their behavior is implemented; see the
[implementation plan](roadmap/implementation.md) for current progress.
For prose changes, review the diff and check local links, fragment destinations,
provenance, template residue, and consistency with current repository contents.

View File

@@ -456,7 +456,7 @@ LGPL licensing and attribution notices remain consistent.
## Stage 2: Implement the runtime version facade
Status: Pending. Depends on Stage 1.
Status: Complete. Depends on Stage 1.
1. Implement `buildinfo.Version` and its internal injected-string and main-module
fallback logic. Keep runtime state private and the public accessor small.
@@ -470,6 +470,15 @@ Acceptance: a source-built fixture reports `dev`; a fixture linked with a stable
version reports that version. Fallback metadata uses the executable main module.
CLI version output is correct and no runtime orchestration initialization occurs.
Completion evidence: implemented `buildinfo.Version`, its private injected
string and main-module fallback, and the internal linker-symbol contract. Unit
tests cover injection precedence and missing, development, and stable main
module metadata. Built and ran a separate consumer executable from source and
with an injected stable version using network-disabled Go commands; both
reported the selected value. CLI tests cover its version line, and the CLI's
dependency closure contains no orchestration package. Added runtime consumer
guidance and documented the command contract.
## Stage 3: Protect public contracts and dependency direction
Status: Pending. Depends on Stage 2.

24
docs/runtime.md Normal file
View File

@@ -0,0 +1,24 @@
# Runtime version
Applications can read their embedded version through the public `buildinfo`
package:
```go
import "gitea.maximumdirect.net/eric/ReleaseKit/buildinfo"
version := buildinfo.Version()
```
`Version` returns the identifier injected into the executable when present.
Otherwise it returns the executable's main module version when that metadata is
available and is not `(devel)`. It returns `dev` when neither source provides a
release identifier. Applications should use this accessor for version output;
the runtime implementation and ReleaseKit's builder own the injection detail.
ReleaseKit's current command prints its own runtime version:
```sh
go run ./cmd/releasekit version
```
The output has the form `releasekit <version>`.