|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +### Building |
| 8 | +```bash |
| 9 | +go build -o bin/git-presenter ./cmd/git-presenter |
| 10 | +``` |
| 11 | + |
| 12 | +### Running Tests |
| 13 | +```bash |
| 14 | +go test ./internal/controller ./internal/presentation ./internal/presenter ./internal/slide |
| 15 | +``` |
| 16 | + |
| 17 | +### Testing Single Package |
| 18 | +```bash |
| 19 | +go test ./internal/controller # Controller tests |
| 20 | +go test ./internal/presentation # Presentation tests |
| 21 | +go test ./internal/presenter # Presenter tests |
| 22 | +go test ./internal/slide # Slide tests |
| 23 | +``` |
| 24 | + |
| 25 | +### Installation |
| 26 | +```bash |
| 27 | +go build -o $HOME/bin/git-presenter ./cmd/git-presenter |
| 28 | +``` |
| 29 | + |
| 30 | +## Architecture Overview |
| 31 | + |
| 32 | +Git Presenter follows clean architecture principles with clear separation of concerns: |
| 33 | + |
| 34 | +**Entry Point**: `cmd/git-presenter/main.go` |
| 35 | +- Handles command-line argument parsing |
| 36 | +- Creates GitPresenter instance and delegates to it |
| 37 | +- Supports both interactive and command modes (`-c` flag) |
| 38 | + |
| 39 | +**Core Components**: |
| 40 | + |
| 41 | +1. **GitPresenter** (`internal/presenter/presenter.go`) |
| 42 | + - Main orchestrator that coordinates all components |
| 43 | + - Handles command routing and interactive mode |
| 44 | + - Manages the presentation lifecycle |
| 45 | + |
| 46 | +2. **Controller** (`internal/controller/controller.go`) |
| 47 | + - Manages presentation initialization and configuration |
| 48 | + - Interfaces with git repository using go-git library |
| 49 | + - Creates `.presentation` YAML file with slide metadata |
| 50 | + - Handles git operations for discovering commits |
| 51 | + |
| 52 | +3. **Presentation** (`internal/presentation/presentation.go`) |
| 53 | + - Core presentation logic and state management |
| 54 | + - Handles slide navigation (next, back, start, end, list) |
| 55 | + - Manages current slide tracking and status display |
| 56 | + - Provides interactive command execution |
| 57 | + |
| 58 | +4. **Slide** (`internal/slide/slide.go`) |
| 59 | + - Represents individual slides (git commits) |
| 60 | + - Handles git checkout operations to move between commits |
| 61 | + - Stores commit hash and message metadata |
| 62 | + |
| 63 | +## Key Dependencies |
| 64 | + |
| 65 | +- **go-git/go-git/v5**: Git operations and repository management |
| 66 | +- **gopkg.in/yaml.v2**: YAML parsing for presentation configuration |
| 67 | +- **Go standard library**: Core functionality |
| 68 | + |
| 69 | +## Presentation Workflow |
| 70 | + |
| 71 | +1. **Initialize**: `git-presenter init` creates `.presentation` file from git history |
| 72 | +2. **Start**: `git-presenter start` begins presentation (interactive or command mode) |
| 73 | +3. **Navigate**: Use commands like `next`, `back`, `start`, `end`, `list` |
| 74 | +4. **Update**: `git-presenter update` refreshes presentation configuration |
| 75 | + |
| 76 | +## Development Methodology |
| 77 | + |
| 78 | +The codebase follows Test-Driven Development (TDD) with comprehensive test coverage for all components. Each package has corresponding `*_test.go` files that should be maintained when making changes. |
| 79 | + |
| 80 | +## Important Files |
| 81 | + |
| 82 | +- `.presentation`: YAML configuration file created by `init` command |
| 83 | +- `go.mod`: Module definition with go-git dependency |
| 84 | +- `internal/`: All application logic following clean architecture |
| 85 | +- `cmd/git-presenter/main.go`: Application entry point |
| 86 | + |
| 87 | +## Testing Strategy |
| 88 | + |
| 89 | +Tests are organized by package and focus on unit testing individual components. When adding new features, ensure corresponding tests are added to maintain coverage. |
0 commit comments