Adopt ReleaseKit tool and runtime version identity
This commit is contained in:
@@ -9,11 +9,9 @@ import (
|
|||||||
|
|
||||||
"gitea.maximumdirect.net/eric/scriptorium/internal/adapter/cli"
|
"gitea.maximumdirect.net/eric/scriptorium/internal/adapter/cli"
|
||||||
"go.maximumdirect.net/commandkit"
|
"go.maximumdirect.net/commandkit"
|
||||||
|
"go.maximumdirect.net/releasekit/buildinfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "dev"
|
|
||||||
var revision = ""
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
os.Exit(runWithSignals(os.Args[1:], os.Stdout, os.Stderr))
|
os.Exit(runWithSignals(os.Args[1:], os.Stdout, os.Stderr))
|
||||||
}
|
}
|
||||||
@@ -25,5 +23,5 @@ func runWithSignals(args []string, stdout, stderr io.Writer) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func run(ctx context.Context, args []string, stdout, stderr io.Writer) int {
|
func run(ctx context.Context, args []string, stdout, stderr io.Writer) int {
|
||||||
return cli.Execute(ctx, commandkit.Identity{Name: "scriptorium", Version: version, Revision: revision}, args, stdout, stderr).Status
|
return cli.Execute(ctx, commandkit.Identity{Name: "scriptorium", Version: buildinfo.Version()}, args, stdout, stderr).Status
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,16 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.maximumdirect.net/releasekit/buildinfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProcessIdentityAndNativeStatus(t *testing.T) {
|
func TestProcessIdentityAndNativeStatus(t *testing.T) {
|
||||||
var output, diagnostics bytes.Buffer
|
var output, diagnostics bytes.Buffer
|
||||||
if status := run(context.Background(), []string{"version"}, &output, &diagnostics); status != 0 || !strings.Contains(output.String(), version) {
|
if status := run(context.Background(), []string{"version"}, &output, &diagnostics); status != 0 || output.String() != "scriptorium "+buildinfo.Version()+"\n" {
|
||||||
t.Fatalf("version status=%d output=%q diagnostics=%q", status, output.String(), diagnostics.String())
|
t.Fatalf("version status=%d output=%q diagnostics=%q", status, output.String(), diagnostics.String())
|
||||||
}
|
}
|
||||||
output.Reset()
|
output.Reset()
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ native behavior instead of reconstructing it from Scriptorium's old script.
|
|||||||
|
|
||||||
## Stage 1: Register The Tool And Adopt Runtime Version Identity
|
## Stage 1: Register The Tool And Adopt Runtime Version Identity
|
||||||
|
|
||||||
|
**Completed:** Entrypoint tests and a temporary application build passed with
|
||||||
|
Go 1.27.4; the built `version` command ran without configuration or credentials.
|
||||||
|
The registered host-target tool reported `releasekit v0.10.0`, and `go mod
|
||||||
|
tidy` retained its tool declaration.
|
||||||
|
|
||||||
**Primary files:** `go.mod`, `go.sum`, `cmd/scriptorium/main.go`,
|
**Primary files:** `go.mod`, `go.sum`, `cmd/scriptorium/main.go`,
|
||||||
`cmd/scriptorium/main_test.go`.
|
`cmd/scriptorium/main_test.go`.
|
||||||
|
|
||||||
|
|||||||
5
go.mod
5
go.mod
@@ -8,6 +8,7 @@ require (
|
|||||||
go.maximumdirect.net/commandkit v0.8.0
|
go.maximumdirect.net/commandkit v0.8.0
|
||||||
go.maximumdirect.net/configkit v1.4.0
|
go.maximumdirect.net/configkit v1.4.0
|
||||||
go.maximumdirect.net/promptkit v0.25.0
|
go.maximumdirect.net/promptkit v0.25.0
|
||||||
|
go.maximumdirect.net/releasekit v0.10.0
|
||||||
go.yaml.in/yaml/v4 v4.0.0
|
go.yaml.in/yaml/v4 v4.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,5 +17,9 @@ require (
|
|||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect
|
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect
|
||||||
github.com/spf13/cobra v1.10.2 // indirect
|
github.com/spf13/cobra v1.10.2 // indirect
|
||||||
github.com/spf13/pflag v1.1.0 // indirect
|
github.com/spf13/pflag v1.1.0 // indirect
|
||||||
|
github.com/yuin/goldmark/v2 v2.1.16 // indirect
|
||||||
|
golang.org/x/mod v0.43.0 // indirect
|
||||||
golang.org/x/text v0.44.0 // indirect
|
golang.org/x/text v0.44.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tool go.maximumdirect.net/releasekit/cmd/releasekit
|
||||||
|
|||||||
6
go.sum
6
go.sum
@@ -11,6 +11,8 @@ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiT
|
|||||||
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/pflag v1.1.0 h1:6W6MbVUrnMb8PEhjkqwsVLY7ryuzRfFHF4mQd7L94ag=
|
github.com/spf13/pflag v1.1.0 h1:6W6MbVUrnMb8PEhjkqwsVLY7ryuzRfFHF4mQd7L94ag=
|
||||||
github.com/spf13/pflag v1.1.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.1.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/yuin/goldmark/v2 v2.1.16 h1:MXvCVo+Cb2SVJ5cwJUzXetDjI7HECRJCkcqylEQtcJo=
|
||||||
|
github.com/yuin/goldmark/v2 v2.1.16/go.mod h1:G6M4/qOFtfn01/o14BU1UR2Lo5N3S9Qo7xCuz/sHjGQ=
|
||||||
go.maximumdirect.net/ckconfig v0.11.0 h1:oTPW5R4vW5TNs97rqgABC/dir723rbGBz0FUyZ9QiNk=
|
go.maximumdirect.net/ckconfig v0.11.0 h1:oTPW5R4vW5TNs97rqgABC/dir723rbGBz0FUyZ9QiNk=
|
||||||
go.maximumdirect.net/ckconfig v0.11.0/go.mod h1:9phvXeLAgQSBKpJWqPyIQASKVJr0nRhiPMIQkfNhaRo=
|
go.maximumdirect.net/ckconfig v0.11.0/go.mod h1:9phvXeLAgQSBKpJWqPyIQASKVJr0nRhiPMIQkfNhaRo=
|
||||||
go.maximumdirect.net/ckprompt v0.12.0 h1:TPx4c0ohnG51F5eXk9SLHvkSKGNnWBhzkJAC5LdZCrE=
|
go.maximumdirect.net/ckprompt v0.12.0 h1:TPx4c0ohnG51F5eXk9SLHvkSKGNnWBhzkJAC5LdZCrE=
|
||||||
@@ -21,9 +23,13 @@ go.maximumdirect.net/configkit v1.4.0 h1:TfOupZbQ23/ZMs+xt5lmyukCF11ekqKep8KbmFQ
|
|||||||
go.maximumdirect.net/configkit v1.4.0/go.mod h1:ewu6blSokUDCMovy8JBXAdXRikGmlHXAQpFghnPWRfs=
|
go.maximumdirect.net/configkit v1.4.0/go.mod h1:ewu6blSokUDCMovy8JBXAdXRikGmlHXAQpFghnPWRfs=
|
||||||
go.maximumdirect.net/promptkit v0.25.0 h1:vJOfxauwASllOSDceR2oypJ4NEwIh2s6F8dDexEzdM8=
|
go.maximumdirect.net/promptkit v0.25.0 h1:vJOfxauwASllOSDceR2oypJ4NEwIh2s6F8dDexEzdM8=
|
||||||
go.maximumdirect.net/promptkit v0.25.0/go.mod h1:o2axdkV11KTPDgk81i2vrJ66dtcedXRhau/Ko3YSZ4A=
|
go.maximumdirect.net/promptkit v0.25.0/go.mod h1:o2axdkV11KTPDgk81i2vrJ66dtcedXRhau/Ko3YSZ4A=
|
||||||
|
go.maximumdirect.net/releasekit v0.10.0 h1:3GOgaIigXTkvYaRkntWZASE//2NTR1+IhkoKmt64aJo=
|
||||||
|
go.maximumdirect.net/releasekit v0.10.0/go.mod h1:cT5NZNEcf7SKDx4MPG40YNK9V4bNyIxcLLFuNlbGQ90=
|
||||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||||
go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
|
go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
|
||||||
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
||||||
|
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
|
||||||
|
golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY=
|
||||||
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
|
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
|
||||||
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
|
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
|||||||
Reference in New Issue
Block a user