Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
repos:
# Go formatting and imports
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
# Format Go code with gofmt
- id: go-fmt
# Organize Go imports
- id: go-imports
# Run go mod tidy
- id: go-mod-tidy
# Run go vet
- id: go-vet-mod
# Build the project to catch compilation errors
- id: go-build-mod

# General hooks for all files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# Remove trailing whitespace
- id: trailing-whitespace
# Ensure files end with newline
- id: end-of-file-fixer
# Check YAML files are valid
- id: check-yaml
# Check JSON files are valid
- id: check-json
# Check for merge conflict markers
- id: check-merge-conflict
# Prevent committing large files
- id: check-added-large-files
args: ['--maxkb=1000']
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,42 @@ sudo mv cwt /usr/local/bin/
3. **State Tracking**: CWT monitors session status and git changes
4. **TUI Interface**: Real-time dashboard built with terminal UI components

## Development

### Setting Up Pre-commit Hooks

This project uses pre-commit hooks to catch linting and formatting issues before they reach CI:

```bash
# Install pre-commit (one-time setup)
pip install pre-commit

# Install the git hook scripts
pre-commit install

# (Optional) Run hooks on all files
pre-commit run --all-files
```

### Available Make Targets

```bash
make help # Show available targets
make test # Run tests
make build # Build binary
make lint # Run basic linting
make clean # Clean build artifacts
```

### Pre-commit Hooks

The pre-commit configuration includes:
- **gofmt**: Code formatting
- **goimports**: Import organization
- **go mod tidy**: Dependency management
- **go vet**: Basic linting
- **General checks**: trailing whitespace, file endings, YAML/JSON validation

## Contributing

See [workflows.md](workflows.md) for detailed workflow documentation.
Expand Down
Loading