diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-23 17:13:45 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-23 17:13:45 +0300 |
| commit | 97e0151ba6a260195ced76ab69d3e3bd58ba68fc (patch) | |
| tree | cf158f895aa353ba9a6308358f4c333924bcfa14 | |
Initial gitsyncer implementation with version support
- Initialize Go module for github.com/paul/gitsyncer
- Add version package with version info (v0.1.0)
- Implement main.go with --version flag support
- Create comprehensive Taskfile.yaml for build automation
- Add CLAUDE.md with project documentation
The binary can be built with 'task' or 'go build -o gitsyncer ./cmd/gitsyncer'
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
| -rw-r--r-- | CLAUDE.md | 77 | ||||
| -rw-r--r-- | Taskfile.yaml | 94 | ||||
| -rw-r--r-- | cmd/gitsyncer/main.go | 25 | ||||
| -rwxr-xr-x | gitsyncer | bin | 0 -> 1523896 bytes | |||
| -rw-r--r-- | go.mod | 3 | ||||
| -rw-r--r-- | internal/version/version.go | 31 |
6 files changed, 230 insertions, 0 deletions
diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..8b9a1d2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,77 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Development Commands + +Essential commands for development: + +```bash +# Build the binary (using go-task if installed) +task # or: go build -o gitsyncer ./cmd/gitsyncer + +# Build for all platforms +task build-all + +# Run the application +task run # or: ./gitsyncer + +# Run tests +task test + +# Format code +task fmt + +# Clean build artifacts +task clean + +# Show version +./gitsyncer --version +``` + +Note: The Taskfile.yaml is configured for [go-task](https://taskfile.dev/). Install with: +```bash +# macOS +brew install go-task + +# Linux +sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin + +# Or use Go directly if task is not installed +go build -o gitsyncer ./cmd/gitsyncer +``` + +## Project Structure + +``` +gitsyncer/ +├── cmd/ +│ └── gitsyncer/ +│ └── main.go # Main entry point with CLI flags +├── internal/ +│ └── version/ +│ └── version.go # Version information +├── go.mod # Go module definition +└── Taskfile.yaml # Task automation (go-task) +``` + +This follows the standard Go project layout with: +- `cmd/` for application entry points +- `internal/` for private application code +- Root directory for public libraries (if any) + +## Architecture + +The application currently provides: +- Version information system (internal/version) +- CLI flag parsing for --version +- Placeholder for main gitsyncer functionality + +## Next Steps + +The project needs: +1. Implementation of the main git synchronization functionality +2. Configuration handling (config files, environment variables) +3. Git repository management logic +4. Sync strategies implementation +5. Tests for all components
\ No newline at end of file diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..94a968b --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,94 @@ +version: '3' + +vars: + BINARY_NAME: gitsyncer + BUILD_DIR: . + CMD_PATH: ./cmd/gitsyncer + LDFLAGS: -s -w + +tasks: + default: + desc: Build the gitsyncer binary + cmds: + - go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_PATH}} + + build: + desc: Build the gitsyncer binary + cmds: + - go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_PATH}} + + build-all: + desc: Build for all supported platforms + cmds: + - task: build-linux + - task: build-darwin + - task: build-windows + + build-linux: + desc: Build for Linux + cmds: + - GOOS=linux GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-linux-amd64 {{.CMD_PATH}} + + build-darwin: + desc: Build for macOS + cmds: + - GOOS=darwin GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-amd64 {{.CMD_PATH}} + - GOOS=darwin GOARCH=arm64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-arm64 {{.CMD_PATH}} + + build-windows: + desc: Build for Windows + cmds: + - GOOS=windows GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-windows-amd64.exe {{.CMD_PATH}} + + run: + desc: Build and run the gitsyncer binary + cmds: + - task: build + - ./{{.BINARY_NAME}} + + test: + desc: Run tests + cmds: + - go test ./... + + test-verbose: + desc: Run tests with verbose output + cmds: + - go test -v ./... + + clean: + desc: Clean build artifacts + cmds: + - rm -f {{.BINARY_NAME}} + - rm -f {{.BINARY_NAME}}-* + + mod-tidy: + desc: Tidy go modules + cmds: + - go mod tidy + + fmt: + desc: Format Go code + cmds: + - go fmt ./... + + vet: + desc: Run go vet + cmds: + - go vet ./... + + lint: + desc: Run golangci-lint + cmds: + - golangci-lint run + + install: + desc: Install gitsyncer to $GOPATH/bin + cmds: + - go install {{.CMD_PATH}} + + version: + desc: Show version + deps: [build] + cmds: + - ./{{.BINARY_NAME}} --version
\ No newline at end of file diff --git a/cmd/gitsyncer/main.go b/cmd/gitsyncer/main.go new file mode 100644 index 0000000..3a38d32 --- /dev/null +++ b/cmd/gitsyncer/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "flag" + "fmt" + "os" + + "github.com/paul/gitsyncer/internal/version" +) + +func main() { + var versionFlag bool + flag.BoolVar(&versionFlag, "version", false, "print version information") + flag.BoolVar(&versionFlag, "v", false, "print version information (short)") + flag.Parse() + + if versionFlag { + fmt.Println(version.GetVersion()) + os.Exit(0) + } + + // TODO: Implement main gitsyncer functionality + fmt.Println("gitsyncer - Git repository synchronization tool") + fmt.Println("Use --version to display version information") +}
\ No newline at end of file diff --git a/gitsyncer b/gitsyncer Binary files differnew file mode 100755 index 0000000..1f897cd --- /dev/null +++ b/gitsyncer @@ -0,0 +1,3 @@ +module github.com/paul/gitsyncer + +go 1.24.3 diff --git a/internal/version/version.go b/internal/version/version.go new file mode 100644 index 0000000..79661ce --- /dev/null +++ b/internal/version/version.go @@ -0,0 +1,31 @@ +package version + +import ( + "fmt" + "runtime" +) + +var ( + // Version is the current version of gitsyncer + Version = "0.1.0" + + // GitCommit is the git commit hash at build time + GitCommit = "unknown" + + // BuildDate is the date when the binary was built + BuildDate = "unknown" + + // GoVersion is the Go version used to build + GoVersion = runtime.Version() +) + +// GetVersion returns the full version string +func GetVersion() string { + return fmt.Sprintf("gitsyncer version %s (commit: %s, built: %s, go: %s)", + Version, GitCommit, BuildDate, GoVersion) +} + +// GetShortVersion returns just the version number +func GetShortVersion() string { + return Version +}
\ No newline at end of file |
