Time Tracker is a simple CLI tool to track the time you spend on different projects and tasks throughout the day. It stores time entries in a JSON file and ensures only one entry can be active at a time.
Note
This project is based on LeanMendez/time-tracker. The codebase has been reworked to use a time entry data model instead of tasks.
Warning
This project is a work in progress. Things may break.
To install this application, you will need Go 1.24.0 or higher. You can download it from the official Golang website. To verify your Go installation and version, run the following command in your terminal:
go version- Clone the repository:
git clone https://github.com/mrs-electronics-inc/time-tracker.git- Use the go install command to compile and install the binary automatically in your $GOPATH/bin directory:
go installNote - if $GOPATH is not defined on your system, look in the following locations:
- Unix systems:
$HOME/go - Windows:
%USERPROFILE%\go
(It is a good idea to add GOPATH to your PATH)
Note
To make things easier, you can create an alias in your shell for the time-tracker command.
We like to use t.
The Time Tracker features an interactive Terminal User Interface (TUI) for a more intuitive experience.
Launch the TUI:
time-trackerThe TUI provides a visual list of your time entries with the following keyboard shortcuts:
| Key | Action |
|---|---|
j / ↓ |
Move down |
k / ↑ |
Move up |
G |
Jump to current entry |
s |
Start/stop tracking |
? |
Toggle help |
q / esc |
Quit |
The time tracker uses a combined command that can be invoked as start, stop, or s (short alias).
To start tracking time for a project and task:
time-tracker start <project> <title>
# or
time-tracker s <project> <title>To resume tracking by entry ID:
time-tracker start <ID>
# or
time-tracker s <ID>This will start a new time entry or resume an existing one. If another entry is currently running, it will be automatically stopped first.
Examples:
time-tracker start "my-project" "Working on feature"
time-tracker start 5 # Resume entry with ID 5To stop the currently running time entry:
time-tracker stop
# or
time-tracker sThis stops the active entry and shows the duration.
If no entry is running, it will show an error.
Note: The stop command does not accept arguments. Use start to begin tracking a new entry.
To list all time entries:
time-tracker listDisplays all entries in chronological order (newest first) with ID, start time, end time (or "running"), project, title, and duration.
To view time tracking statistics:
time-tracker statsDisplays daily totals for the past week in table format, including breakdowns by project.
Options:
--weekly: Show weekly totals for the past month
Examples:
time-tracker stats # Daily totals
time-tracker stats --weekly # Weekly totalsFor programmatic interaction (e.g., AI agents, automated testing), Time Tracker provides a headless HTTP server:
# Start the headless server
just run-docker headless
# Or with custom options
just run-docker headless --port 9000| Endpoint | Method | Description |
|---|---|---|
/input |
POST | Send input action, receive updated state |
/state |
GET | Get current state |
/render/latest |
GET | Redirect to most recent PNG render |
/render/{timestamp}.png |
GET | Get specific PNG render |
# Send keyboard input
just input key j
just input key enter
just input key shift+tab
# Type text
just input type "hello world"
# Resize terminal
just input resize 40 160{
"width": 160,
"height": 40,
"mode": "list",
"render_url": "/render/2026-01-08T10-45-32-123.png",
"ansi": "\u001b[1;92mStart..."
}- Binds to localhost by default (
--bind 0.0.0.0to expose) - No authentication
- May expose sensitive time tracking data
- Never expose to untrusted networks
- Language: Go
- CLI Framework: Cobra
- TUI Framework: Bubble Tea + Bubbles
- Styling: Lipgloss
To develop this project, you need:
- Go 1.24.0 or higher
- Docker and Docker Compose (for running the app and tests)
- just (recommended for running development commands)
- Nix (optional, for reproducible development environment)
- Clone the repository:
git clone https://github.com/mrs-electronics-inc/time-tracker.git
cd time-tracker- All development tasks use the
justcommand runner (see justfile for all available recipes).
Testing and Building:
# Run all tests
just test
# Build the Docker image
just buildRunning the Application:
# Run the TUI (interactive interface)
just run
# Run the CLI with any subcommand and flags
just run start "project-name" "task-name"
just run stop
just run list
just run list --all
just run edit
just run stats
just run stats --weekly
just run stats --rows 7Debugging:
# View the dev data file from the Docker volume
just inspect-data
# Import JSON data into the dev volume (overwrites existing data)
# Always use the latest data version from models/migration_types.go
just import-data < data.jsonImportant: Never run the binary directly on the host system. Always use just run for CLI and TUI testing. This ensures the app uses the Docker volume for data persistence.
The vendor directory is gitignored. Dependencies are fetched from the network during builds.
When go.mod changes:
- Set
vendorHash = "";inflake.nix(empty string) - Run
nix build 2>&1 | grep -E "(specified|got):" - Copy the
got:hash and updatevendorHashinflake.nix - Run
nix buildagain to verify - Do NOT run
go mod vendor- the vendor directory should remain empty
All the code is under the MIT license. Contributions are welcome!