This file provides guidance to AI coding agents when working with code in this repository.
Gilt is a Git repository overlay tool written in Go 1.25. It clones Git
repositories, checks out specific versions (tags or SHAs), and copies files or
directories into a target project. Module path: github.com/retr0h/gilt/v2.
For setup, building, testing, and contributing, see the Docusaurus docs:
- @docs/docs/development.md - Prerequisites, setup, code style, testing, commit conventions
- @docs/docs/contributing.md - PR workflow and contribution guidelines
- @docs/docs/testing.md - How to run tests and list task recipes
- @docs/docs/architecture.md - Package architecture and design patterns
Quick reference for common commands:
task deps # Install all dependencies
task test # Run all tests (lint + unit + coverage + bats)
task unit # Run unit tests only
task vet # Run golangci-lint
task fmt # Auto-format (gofumpt + golines)
task fmt:check # Check formatting without modifying
go test -run TestName -v ./internal/... # Run a single testcmd/- Cobra CLI commands (root,overlay,init,version)internal/- Interface definitions (git.go,exec.go,repository.go,repositories.go)internal/git/- Git CLI wrapper (clone, worktree, update, remote)internal/exec/- Command execution abstractioninternal/repository/- Single repository operations (clone, worktree, copy sources)internal/repositories/- Orchestrates overlay across all configured repositoriesinternal/path/- Path utility functionsinternal/mocks/- Generated mocks (mockgen)pkg/config/- Configuration types (Repositories,Repository,Source,Command) with Viper + validator tagspkg/repositories/- Public API entry point for repository operationstest/integration/- Bats integration testsdocs/- Docusaurus documentation sitepython/- Python wheel packaging for PyPI distribution
- Unit tests:
*_test.goin same package for private functions - Public tests:
*_public_test.goin test package (e.g.,package git_test) for exported functions - Integration tests in
test/integration/using Bats - Use
testify/assertandtestify/require
- Interface segregation: small interfaces in
internal/*.go, implementations in sub-packages - Dependency injection via constructors (e.g.,
NewGit(execManager)) - Error wrapping:
fmt.Errorf("context: %w", err) - Early returns over nested if-else
- Unused parameters: rename to
_ - Import order: stdlib, third-party, local (blank-line separated)
golangci-lint with: errcheck, errname, goimports, govet, prealloc, predeclared, revive, staticcheck. Formatting via gofumpt + golines.
See @docs/docs/development.md#branching for full conventions.
When committing changes, create a feature branch first if currently on main.
Branch names use the pattern type/short-description (e.g.,
feat/add-dns-retry, fix/memory-leak, docs/update-readme).
See @docs/docs/development.md#commit-messages for full conventions.
Follow Conventional Commits with the
50/72 rule. Format: type(scope): description.
Work is tracked as markdown files in .tasks/. See @.tasks/README.md for
format details.
.tasks/
├── backlog/ # Tasks not yet started
├── in-progress/ # Tasks actively being worked on
├── done/ # Completed tasks
└── sessions/ # Session work logs (per session)
When starting a session:
- Check
.tasks/in-progress/for ongoing work - Check
.tasks/backlog/for next tasks - Move task files between directories as status changes
- Log session work in
.tasks/sessions/YYYY-MM-DD.md