diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-21 21:37:34 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-21 21:37:34 +0200 |
| commit | 95bdcf2c73a643df227bccf909f3aa17d08b0f1c (patch) | |
| tree | 11db378e2dee076fbf18c1dc58fae1d18c4d8789 | |
| parent | f8574d5ecf31021b1aee7fcb0c8b45c190bffead (diff) | |
Convert Taskfile.yaml to Magefile.go
Replace task runner with mage for build automation.
All existing targets preserved: build, run, test variants, install, clean.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| -rw-r--r-- | CLAUDE.md | 1 | ||||
| -rw-r--r-- | Magefile.go | 81 | ||||
| -rw-r--r-- | go.mod | 3 | ||||
| -rw-r--r-- | go.sum | 2 |
4 files changed, 86 insertions, 1 deletions
diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Magefile.go b/Magefile.go new file mode 100644 index 0000000..0d355cd --- /dev/null +++ b/Magefile.go @@ -0,0 +1,81 @@ +//go:build mage + +package main + +import ( + "fmt" + "os" + + "github.com/magefile/mage/sh" +) + +var Default = Build + +// Build compiles the totalrecall binary +func Build() error { + return sh.RunV("go", "build", "-o", "totalrecall", "./cmd/totalrecall") +} + +// Run executes the application without building +func Run() error { + return sh.RunV("go", "run", "./cmd/totalrecall") +} + +// Test runs all tests +func Test() error { + return sh.RunV("go", "test", "./...") +} + +// TestVerbose runs all tests with verbose output +func TestVerbose() error { + return sh.RunV("go", "test", "-v", "./...") +} + +// TestCoverage runs all tests with coverage report +func TestCoverage() error { + return sh.RunV("go", "test", "-cover", "./...") +} + +// TestCoverageHtml runs all tests and generates HTML coverage report +func TestCoverageHtml() error { + if err := sh.RunV("go", "test", "-coverprofile=coverage.out", "./..."); err != nil { + return err + } + if err := sh.RunV("go", "tool", "cover", "-html=coverage.out", "-o", "coverage.html"); err != nil { + return err + } + fmt.Println("Coverage report generated at coverage.html") + return nil +} + +// TestRace runs all tests with race detector +func TestRace() error { + return sh.RunV("go", "test", "-race", "./...") +} + +// TestShort runs only short tests (skip integration tests) +func TestShort() error { + return sh.RunV("go", "test", "-short", "./...") +} + +// TestAll runs comprehensive test suite with coverage and race detection +func TestAll() error { + fmt.Println("Running comprehensive test suite...") + return sh.RunV("go", "test", "-v", "-race", "-cover", "./...") +} + +// Install installs the binary to Go bin directory +func Install() error { + return sh.RunV("go", "install", "./cmd/totalrecall") +} + +// Clean removes build artifacts and test coverage files +func Clean() error { + files := []string{"totalrecall", "coverage.out", "coverage.html"} + for _, f := range files { + if err := os.Remove(f); err != nil && !os.IsNotExist(err) { + return err + } + } + return sh.RunV("go", "clean", "-testcache") +} @@ -5,9 +5,11 @@ go 1.24.4 require ( fyne.io/fyne/v2 v2.6.1 github.com/dweymouth/fyne-tooltip v0.3.3 + github.com/magefile/mage v1.15.0 github.com/mattn/go-sqlite3 v1.14.28 github.com/sashabaranov/go-openai v1.40.5 github.com/spf13/cobra v1.9.1 + github.com/spf13/pflag v1.0.6 github.com/spf13/viper v1.20.1 ) @@ -41,7 +43,6 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.12.0 // indirect github.com/spf13/cast v1.7.1 // indirect - github.com/spf13/pflag v1.0.6 // indirect github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect github.com/stretchr/testify v1.10.0 // indirect @@ -58,6 +58,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= +github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= |
