diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7993d64 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + name: Test (Go ${{ matrix.go }}) + runs-on: ubuntu-latest + strategy: + matrix: + go: ["1.24", "1.26"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + - name: Build + run: go build ./... + - name: Vet + run: go vet ./... + - name: Test + run: go test -race ./... + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.26" + - uses: golangci/golangci-lint-action@v6 + with: + version: latest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..180d5c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Binaries and build artifacts +/gitflow +/dist/ +*.exe + +# Test artifacts +*.test +coverage.out + +# Editor / OS cruft +.DS_Store +.idea/ +.vscode/ +*.swp + +# Local config overrides (never commit personal settings) +.gitflow.local.yaml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..d6c8a57 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,24 @@ +# golangci-lint configuration for gitflow. +# Docs: https://golangci-lint.run/usage/configuration/ + +run: + timeout: 5m + +linters: + enable: + - errcheck # unchecked errors + - govet # go vet + - staticcheck # static analysis + - gosimple # simplify code + - ineffassign # ineffective assignments + - unused # unused declarations + - misspell # typos in comments/strings + - gofmt # formatting + - goimports # import grouping + +issues: + exclude-rules: + # Tests may use underscores to match fixture naming. + - path: _test\.go + linters: + - errcheck diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3778b2e --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +BINARY := gitflow +MODULE := gitea.oblak.solutions/dimitar/gitFlow +VERSION ?= dev +LDFLAGS := -ldflags "-X $(MODULE)/internal/version.Version=$(VERSION)" + +.PHONY: build test fmt vet lint install clean + +## build: compile the gitflow binary into the repo root +build: + go build $(LDFLAGS) -o $(BINARY) ./cmd/gitflow + +## test: run the full test suite +test: + go test ./... + +## fmt: format all Go sources +fmt: + gofmt -l -w . + +## vet: run go vet over all packages +vet: + go vet ./... + +## lint: run golangci-lint (requires golangci-lint on PATH) +lint: + golangci-lint run + +## install: install gitflow into GOBIN +install: + go install $(LDFLAGS) ./cmd/gitflow + +## clean: remove build artifacts +clean: + rm -f $(BINARY) + rm -f coverage.out diff --git a/cmd/gitflow/main.go b/cmd/gitflow/main.go new file mode 100644 index 0000000..3b3e0b7 --- /dev/null +++ b/cmd/gitflow/main.go @@ -0,0 +1,16 @@ +// Command gitflow is a CLI tool that discovers Git repositories under a +// user-specified parent directory, scans their status, and presents findings +// with AI-driven suggestions for next actions. +package main + +import ( + "fmt" + "os" + + "gitea.oblak.solutions/dimitar/gitFlow/internal/version" +) + +func main() { + fmt.Printf("gitflow %s\n", version.Version) + os.Exit(0) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..82c3d32 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module gitea.oblak.solutions/dimitar/gitFlow + +go 1.24 diff --git a/internal/version/version.go b/internal/version/version.go new file mode 100644 index 0000000..4e28d63 --- /dev/null +++ b/internal/version/version.go @@ -0,0 +1,8 @@ +// Package version exposes build metadata for the gitflow binary. +package version + +// Version is the semantic version of the binary. It can be overridden at +// build time with: +// +// go build -ldflags "-X gitea.oblak.solutions/dimitar/gitFlow/internal/version.Version=v1.2.3" ./cmd/gitflow +var Version = "dev"