Skip to content

Commit 464449f

Browse files
Flatten internal directory structure and update build configuration
- Move all Go files from subdirectories to internal/ root - Update all package declarations to use 'internal' package - Remove internal import statements between components - Update type references to work with flattened structure - Remove empty subdirectories after file moves - Update CLAUDE.md to reflect new structure - Add .gitignore for bin/ and .presentation files - Update GitHub workflow to test flattened internal package - Maintain all functionality while simplifying code organization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0a63bb6 commit 464449f

13 files changed

Lines changed: 31 additions & 35 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
go-version: '1.21'
1919

2020
- name: Run tests
21-
run: go test ./internal/controller ./internal/presentation ./internal/presenter ./internal/slide
21+
run: go test ./internal
2222

2323
- name: Run go vet
2424
run: go vet ./...

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin/
2+
.presentation

CLAUDE.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ go build -o bin/git-presenter ./cmd/git-presenter
1111

1212
### Running Tests
1313
```bash
14-
go test ./internal/controller ./internal/presentation ./internal/presenter ./internal/slide
14+
go test ./internal
1515
```
1616

1717
### Testing Single Package
1818
```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
19+
go test ./internal # All tests in internal package
2320
```
2421

2522
### Installation
@@ -36,26 +33,26 @@ Git Presenter follows clean architecture principles with clear separation of con
3633
- Creates GitPresenter instance and delegates to it
3734
- Supports both interactive and command modes (`-c` flag)
3835

39-
**Core Components**:
36+
**Core Components** (all in `internal/` package):
4037

41-
1. **GitPresenter** (`internal/presenter/presenter.go`)
38+
1. **GitPresenter** (`internal/presenter.go`)
4239
- Main orchestrator that coordinates all components
4340
- Handles command routing and interactive mode
4441
- Manages the presentation lifecycle
4542

46-
2. **Controller** (`internal/controller/controller.go`)
43+
2. **Controller** (`internal/controller.go`)
4744
- Manages presentation initialization and configuration
4845
- Interfaces with git repository using go-git library
4946
- Creates `.presentation` YAML file with slide metadata
5047
- Handles git operations for discovering commits
5148

52-
3. **Presentation** (`internal/presentation/presentation.go`)
49+
3. **Presentation** (`internal/presentation.go`)
5350
- Core presentation logic and state management
5451
- Handles slide navigation (next, back, start, end, list)
5552
- Manages current slide tracking and status display
5653
- Provides interactive command execution
5754

58-
4. **Slide** (`internal/slide/slide.go`)
55+
4. **Slide** (`internal/slide.go`)
5956
- Represents individual slides (git commits)
6057
- Handles git checkout operations to move between commits
6158
- Stores commit hash and message metadata
@@ -86,4 +83,4 @@ The codebase follows Test-Driven Development (TDD) with comprehensive test cover
8683

8784
## Testing Strategy
8885

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.
86+
All tests are in the `internal/` package with a flattened structure. Tests focus on unit testing individual components. When adding new features, ensure corresponding tests are added to maintain coverage.

bin/git-presenter

-9.04 MB
Binary file not shown.

cmd/git-presenter/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"fmt"
55
"os"
6-
"git-presenter/internal/presenter"
6+
"git-presenter/internal"
77
)
88

99
func main() {
@@ -26,7 +26,7 @@ func main() {
2626
os.Exit(1)
2727
}
2828

29-
gitPresenter := presenter.NewGitPresenter(currentDir, interactive)
29+
gitPresenter := internal.NewGitPresenter(currentDir, interactive)
3030

3131
err = gitPresenter.Execute(command)
3232
if err != nil {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package controller
1+
package internal
22

33
import (
44
"fmt"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package controller
1+
package internal
22

33
import (
44
"testing"
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
package presentation
1+
package internal
22

33
import (
44
"fmt"
55
"os/exec"
66
"strings"
7-
"git-presenter/internal/slide"
87
)
98

109
type Presentation struct {
1110
branch string
12-
slides []*slide.Slide
13-
currentSlide *slide.Slide
11+
slides []*Slide
12+
currentSlide *Slide
1413
}
1514

1615
func NewPresentation(config map[string]interface{}) *Presentation {
1716
branch, _ := config["branch"].(string)
1817

19-
var slides []*slide.Slide
18+
var slides []*Slide
2019
if slidesData, ok := config["slides"].([]interface{}); ok {
2120
for _, slideData := range slidesData {
2221
if slideMap, ok := slideData.(map[string]interface{}); ok {
2322
if slideInfo, ok := slideMap["slide"].(map[string]interface{}); ok {
24-
slides = append(slides, slide.NewSlide(slideInfo))
23+
slides = append(slides, NewSlide(slideInfo))
2524
}
2625
}
2726
}
@@ -38,7 +37,7 @@ func NewPresentation(config map[string]interface{}) *Presentation {
3837
return presentation
3938
}
4039

41-
func (p *Presentation) findCurrentSlide() *slide.Slide {
40+
func (p *Presentation) findCurrentSlide() *Slide {
4241
cmd := exec.Command("git", "rev-parse", "HEAD")
4342
output, err := cmd.Output()
4443
if err != nil {

internal/presentation/presentation_test.go renamed to internal/presentation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package presentation
1+
package internal
22

33
import (
44
"testing"
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
package presenter
1+
package internal
22

33
import (
44
"bufio"
55
"fmt"
66
"os"
77
"strings"
8-
"git-presenter/internal/controller"
9-
"git-presenter/internal/presentation"
108
)
119

1210
type GitPresenter struct {
1311
currentDir string
1412
interactive bool
15-
controller *controller.Controller
16-
presentation *presentation.Presentation
13+
controller *Controller
14+
presentation *Presentation
1715
}
1816

1917
func NewGitPresenter(currentDir string, interactive bool) *GitPresenter {
2018
return &GitPresenter{
2119
currentDir: currentDir,
2220
interactive: interactive,
23-
controller: controller.NewController(currentDir),
21+
controller: NewController(currentDir),
2422
}
2523
}
2624

@@ -54,7 +52,7 @@ func (g *GitPresenter) startPresentation() error {
5452
}
5553
}
5654

57-
g.presentation = presentation.NewPresentation(configMap)
55+
g.presentation = NewPresentation(configMap)
5856

5957
if g.interactive {
6058
g.enterRunLoop()
@@ -88,7 +86,7 @@ func (g *GitPresenter) executeNavigationCommand(command string) error {
8886
}
8987
}
9088

91-
g.presentation = presentation.NewPresentation(configMap)
89+
g.presentation = NewPresentation(configMap)
9290
}
9391

9492
result := g.presentation.Execute(command)

0 commit comments

Comments
 (0)