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
18 changes: 9 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ builds:
binary: tmpo
ldflags:
- -s -w
- -X github.com/DylanDevelops/tmpo/cmd.Version={{.Version}}
- -X github.com/DylanDevelops/tmpo/cmd.Commit={{.Commit}}
- -X github.com/DylanDevelops/tmpo/cmd.Date={{.Date}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Version={{.Version}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Commit={{.Commit}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Date={{.Date}}

# Linux
- id: linux
Expand All @@ -25,9 +25,9 @@ builds:
binary: tmpo
ldflags:
- -s -w
- -X github.com/DylanDevelops/tmpo/cmd.Version={{.Version}}
- -X github.com/DylanDevelops/tmpo/cmd.Commit={{.Commit}}
- -X github.com/DylanDevelops/tmpo/cmd.Date={{.Date}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Version={{.Version}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Commit={{.Commit}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Date={{.Date}}

# Windows
- id: windows
Expand All @@ -38,9 +38,9 @@ builds:
binary: tmpo
ldflags:
- -s -w
- -X github.com/DylanDevelops/tmpo/cmd.Version={{.Version}}
- -X github.com/DylanDevelops/tmpo/cmd.Commit={{.Commit}}
- -X github.com/DylanDevelops/tmpo/cmd.Date={{.Date}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Version={{.Version}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Commit={{.Commit}}
- -X github.com/DylanDevelops/tmpo/cmd/utilities.Date={{.Date}}

archives:
- id: windows-zip
Expand Down
15 changes: 8 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ goreleaser build --snapshot --clean

**CLI Layer** (`cmd/`):
- Uses Cobra for command structure
- Each command is a separate file (start.go, stop.go, status.go, etc.)
- All commands registered in `cmd/root.go` via `init()` functions
- Commands organized in subdirectories: tracking/, entries/, history/, setup/, utilities/
- Each command is a constructor function that returns `*cobra.Command`
- All commands explicitly registered in `cmd/root.go` RootCmd() function
- Version information is injected via ldflags during build

**Storage Layer** (`internal/storage/`):
Expand Down Expand Up @@ -83,7 +84,7 @@ defer db.Close()
```

**Project Name Detection:**
The `cmd/start.go:DetectProjectName()` function implements the priority: .tmporc config → Git repository → directory name
The `internal/project.DetectConfiguredProject()` function implements the priority: .tmporc config → Git repository → directory name

**Time Entry States:**
- Running: EndTime is nil
Expand All @@ -107,13 +108,13 @@ Uses `modernc.org/sqlite` (pure Go, no CGO) instead of mattn/go-sqlite3. This is
**Version Injection:**
Version, Commit, and Date are injected at build time via ldflags:
```
-X github.com/DylanDevelops/tmpo/cmd.Version={{.Version}}
-X github.com/DylanDevelops/tmpo/cmd.Commit={{.Commit}}
-X github.com/DylanDevelops/tmpo/cmd.Date={{.Date}}
-X github.com/DylanDevelops/tmpo/cmd/utilities.Version={{.Version}}
-X github.com/DylanDevelops/tmpo/cmd/utilities.Commit={{.Commit}}
-X github.com/DylanDevelops/tmpo/cmd/utilities.Date={{.Date}}
```

**Command Registration:**
New commands must be added via `rootCmd.AddCommand()` in their `init()` function.
New commands should be created as constructor functions (e.g., `StartCmd()`, `StopCmd()`) that return `*cobra.Command`. Each command registers its own flags before returning. Commands are then registered in `cmd/root.go` RootCmd() by calling `cmd.AddCommand(tracking.StartCmd())`.

**Interactive Prompts:**
The `manual` command uses `github.com/manifoldco/promptui` for interactive prompts (date/time input).
23 changes: 16 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ goreleaser build --snapshot --clean
```
tmpo/
├── cmd/ # CLI commands (Using Cobra)
│ ├── command1.go
│ ├── command2.go
│ ├── command3.go
│ ├── ...
│ ├── root.go # Root command with RootCmd() constructor
│ ├── tracking/ # Time tracking commands (start, stop, pause, resume, status)
│ ├── entries/ # Entry management (edit, delete, manual)
│ ├── history/ # History commands (log, stats, export)
│ ├── setup/ # Setup commands (init)
│ └── utilities/ # Utility commands (version)
├── internal/
│ ├── config/ # Configuration management (.tmporc files)
│ ├── storage/ # SQLite database layer
│ ├── project/ # Project detection logic
│ └── export/ # Export functionality
│ ├── export/ # Export functionality
│ └── ui/ # UI helpers (formatting, colors, printing)
├── docs/ # User documentation
│ ├── usage.md
│ └── configuration.md
Expand All @@ -78,10 +81,16 @@ tmpo/
### Key Directories

- **`cmd/`**: Contains all CLI command implementations using Cobra
- **`cmd/tracking/`**: Time tracking commands (start, stop, pause, resume, status)
- **`cmd/entries/`**: Entry management commands (edit, delete, manual)
- **`cmd/history/`**: History and reporting commands (log, stats, export)
- **`cmd/setup/`**: Setup and initialization commands (init)
- **`cmd/utilities/`**: Utility commands and version information (version)
- **`internal/config/`**: Handles `.tmporc` file parsing and configuration
- **`internal/storage/`**: SQLite database operations and models
- **`internal/project/`**: Project name detection logic (git/directory/config)
- **`internal/export/`**: Export functionality used by commands
- **`internal/export/`**: Export functionality (CSV, JSON)
- **`internal/ui/`**: UI helpers for formatting, colors, and terminal output
- **`docs/`**: User-facing documentation and guides

### Data Storage
Expand All @@ -107,7 +116,7 @@ When a user runs `tmpo start`, the project name is detected in this priority ord
2. **Git repository** - Uses `git rev-parse --show-toplevel` to find repo root
3. **Directory name** - Falls back to current directory name

This logic lives in `internal/project/detector.go`.
This logic lives in `internal/project/detect.go`.

## Making Changes

Expand Down
198 changes: 0 additions & 198 deletions cmd/delete.go

This file was deleted.

Loading