From f8fa7aa497d36f9a4b3a1d26b1338859d7195e86 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 15 Dec 2025 11:15:58 -0700 Subject: [PATCH 1/7] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..0014d6d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,83 @@ +# Contributor Covenant 3.0 Code of Conduct + +## Our Pledge + +We pledge to make our community welcoming, safe, and equitable for all. + +We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant. + +## Encouraged Behaviors + +While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language. + +With these considerations in mind, we agree to behave mindfully toward each other and act in ways that center our shared values, including: + +1. Respecting the **purpose of our community**, our activities, and our ways of gathering. +2. Engaging **kindly and honestly** with others. +3. Respecting **different viewpoints** and experiences. +4. **Taking responsibility** for our actions and contributions. +5. Gracefully giving and accepting **constructive feedback**. +6. Committing to **repairing harm** when it occurs. +7. Behaving in other ways that promote and sustain the **well-being of our community**. + +## Restricted Behaviors + +We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are violations of this Code of Conduct. + +1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any clear request to stop. +2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of people. +3. **Stereotyping or discrimination.** Characterizing anyone’s personality or behavior on the basis of immutable identities or traits. +4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or purpose of the community. +5. **Violating confidentiality**. Sharing or acting on someone's personal or private information without their permission. +6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group. +7. Behaving in other ways that **threaten the well-being** of our community. + +### Other Restrictions + +1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade enforcement actions. +2. **Failing to credit sources.** Not properly crediting the sources of content you contribute. +3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the community. +4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviors. + +## Reporting an Issue + +Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help avoid conflicts and minimize harm. + +When an incident does occur, it is important to report it promptly. To report a possible violation, **please contact a project maintainer. If the issue involves a maintainer, please contact the project owner via email.** + +Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution. + +## Addressing and Repairing Harm + +If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped. + +1) Warning + 1) Event: A violation involving a single incident or series of incidents. + 2) Consequence: A private, written warning from the Community Moderators. + 3) Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations. +2) Temporarily Limited Activities + 1) Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation. + 2) Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members. + 3) Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over. +3) Temporary Suspension + 1) Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation. + 2) Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions. + 3) Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted. +4) Permanent Ban + 1) Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member. + 2) Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior. + 3) Repair: There is no possible repair in cases of this severity. + +This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/). + +Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy of this license, visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/) + +For answers to common questions about Contributor Covenant, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional enforcement and community guideline resources can be found at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement ladder was inspired by the work of [Mozilla’s code of conduct team](https://github.com/mozilla/inclusion). From cbb678dcd77df408aa9cab4a3f3ea29b047dccb1 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 15 Dec 2025 11:17:30 -0700 Subject: [PATCH 2/7] Create FUNDING.yml --- .github/FUNDING.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..569fd30 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +# These are supported funding model platforms + +github: [DylanDevelops] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: # Replace with a single Buy Me a Coffee username +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From e4ac975462d0c8a344398d278b14ff82de1178d5 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 15 Dec 2025 13:05:31 -0700 Subject: [PATCH 3/7] Add issue templates for bug reports and feature requests Introduced GitHub issue templates for bug reports and feature requests to standardize and streamline the issue submission process. Also enabled blank issues via config.yml. --- .github/ISSUE_TEMPLATE/bug_report.yml | 56 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.yml | 30 ++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..7db11ed --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,56 @@ +name: πŸ› Bug Report +description: File a bug report +labels: ["status: awaiting triage", "type: bug"] +body: + - type: markdown + attributes: + value: | + Thanks for filing a bug report! This issue tracker is for [tmpo](https://github.com/DylanDevelops/tmpo). Please search the issue tracker to see if there is an existing issue for the problem you are experiencing. + - type: textarea + id: the-problem + attributes: + label: The problem + description: + Describe the issue you are experiencing with tmpo. Provide a + clear and concise description of what you were trying to do and what + happened, along with any error messages you encountered. + validations: + required: true + - type: input + id: version + attributes: + label: Release version + description: + Run `tmpo version` + validations: + required: true + - type: input + id: operating-system + attributes: + label: Operating system + description: + 'Enter the specific operating system version you are running (example: + Windows 11)' + validations: + required: true + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to reproduce the behavior + description: Provide steps to reproduce the problem you are experiencing. + placeholder: | + 1. Go to '...' + 2. Do '....' + 3. Run tmpo '....' + 4. See error + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: Add screenshots to help explain your problem, if applicable. + - type: textarea + id: additional-context + attributes: + label: Additional context + description: + Add any other context about the problem you are experiencing here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..a49eab2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..7140cad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,30 @@ +name: ⭐ Feature Request +description: Submit a feature request +labels: ["status: awaiting triage", "type: feature request"] +body: + - type: markdown + attributes: + value: | + Thanks for submitting a feature request! This issue tracker is for [tmpo](https://github.com/DylanDevelops/tmpo). Please search the issue tracker to see if there is an existing issue for the feature you are requesting. + - type: textarea + id: the-feature-request + attributes: + label: The feature request + description: + Write a clear and concise description of what the feature or problem is. + validations: + required: true + - type: textarea + id: proposed-solution + attributes: + label: Proposed solution + description: Share how this will benefit tmpo and its users. + validations: + required: true + - type: textarea + id: additional-context + attributes: + label: Additional context + description: + Please include any other context, like screenshots or mockups, if + applicable. \ No newline at end of file From 5d99518cc29190bdba9de39a0e2be417becb4ad5 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 15 Dec 2025 13:28:39 -0700 Subject: [PATCH 4/7] Update README.md --- README.md | 290 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 280 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 35ccbab..0b18374 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,290 @@ +# tmpo CLI + +Set the `tmpo` β€” A minimal CLI time tracker for developers. + +

- tmpo Logo + tmpo Logo

-# tmpo +`tmpo` allows you to track time effortlessly with automatic project detection and simple commands that live in your terminal. -> Set the tmpo - Minimal CLI time tracker for developers +## Table of Contents -[Installation] [Quick Start] [Features] [Usage] +* [Getting Started](#getting-started) + * [Installation](#installation) +* [Usage Examples](#usage-examples) +* [Contributing](#contributing) +* [License](#license) -## Quick Start +

+ Installation β€’ + Usage β€’ + Features β€’ + Configuration β€’ + License +

-- `tmpo start` - Start Tracking -- `tmpo stop` - Stop current session -- `tmpo status` - View current session -- `tmpo export` - Export timesheet +--- + +## About + +**tmpo** is a lightweight, developer-friendly time tracking tool designed to integrate seamlessly with your terminal workflow. It automatically detects your project context from Git repositories or configuration files, making time tracking as simple as `tmpo start` and `tmpo stop`. + +### Why tmpo? + +- **πŸš€ Fast & Lightweight** - Built in Go, tmpo starts instantly and uses minimal resources +- **🎯 Automatic Project Detection** - Detects project names from Git repos or `.tmporc` files +- **πŸ’Ύ Local Storage** - All data stored locally in SQLite - your time tracking stays private +- **πŸ“Š Rich Reporting** - View stats, export to CSV/JSON, and track hourly rates +- **⚑ Zero Configuration** - Works out of the box, configure only when you need to ## Installation -Coming soon to homebrew and NPM +### Homebrew (macOS/Linux) + +```bash +# Coming soon +brew install tmpo +``` + +### Download Pre-built Binaries + +Download the latest release for your platform from the [releases page](https://github.com/DylanDevelops/tmpo/releases). + +### Build from Source + +```bash +git clone https://github.com/DylanDevelops/tmpo.git +cd tmpo +go build -o tmpo . +``` + +## Quick Start + +```bash +# Initialize an optional configuration file +tmpo init + +# Start tracking time (auto-detects project from git/directory) +tmpo start + +# Start with a description +tmpo start "Implementing user authentication" + +# Check current status +tmpo status + +# Stop tracking +tmpo stop + +# View your time log +tmpo log + +# See statistics +tmpo stats +``` + +## Usage + +### Basic Commands + +#### `tmpo start [description]` +Start tracking time for the current project. Automatically detects the project name from: +1. `.tmporc` configuration file (if present) +2. Git repository name +3. Current directory name + +```bash +tmpo start # Start tracking +tmpo start "Fix authentication bug" # Start with description +``` + +#### `tmpo stop` +Stop the currently running time entry. + +```bash +tmpo stop +``` + +#### `tmpo status` +View the current tracking session with elapsed time. + +```bash +tmpo status +# Output: +# [tmpo] Currently tracking: my-project +# Started: 2:30 PM +# Duration: 1h 23m +# Description: Implementing feature +``` + +#### `tmpo log` +View your time tracking history. + +```bash +tmpo log # Show recent entries +tmpo log --limit 50 # Show more entries +``` + +#### `tmpo stats` +Display statistics about your tracked time. + +```bash +tmpo stats # All-time stats +tmpo stats --today # Today's stats +tmpo stats --week # This week's stats +``` + +### Project Configuration + +#### `tmpo init` +Create a `.tmporc` configuration file for the current project. + +```bash +tmpo init # Auto-detect project name +tmpo init --name "My Project" # Specify name +tmpo init --name "Client Work" --rate 150 # Set hourly rate +``` + +This creates a `.tmporc` file: + +```yaml +# tmpo project configuration +# This file configures time tracking settings for this project + +# Project name (used to identify time entries) +project_name: My Project + +# [OPTIONAL] Hourly rate for billing calculations (set to 0 to disable) +hourly_rate: 150.00 + +# [OPTIONAL] Description for this project +description: "" +``` + +### Advanced Features + +#### `tmpo manual` +Create manual time entries for past work using an interactive prompt. + +```bash +tmpo manual +# Prompts for: +# - Project name +# - Start date and time +# - End date and time +# - Description +``` + +#### `tmpo export` +Export your time tracking data to CSV or JSON. + +```bash +tmpo export # Export all as CSV +tmpo export --format json # Export as JSON +tmpo export --project "My Project" # Filter by project +tmpo export --today # Export today's entries +tmpo export --week # Export this week +tmpo export --output timesheet.csv # Specify output file +``` + +## Features + +### Automatic Project Detection +tmpo intelligently detects your project context: +- **`.tmporc` files**: Place a config file in your project root for explicit naming +- **Git repositories**: Automatically uses the repository name +- **Directory fallback**: Uses the current directory name + +### Hourly Rate Tracking +Track billable hours with automatic earnings calculations: +```bash +tmpo init --rate 150 +tmpo start "Client consultation" +# When you stop, tmpo shows estimated earnings +``` + +### Flexible Reporting +- **Daily/Weekly stats**: `tmpo stats --today` or `tmpo stats --week` +- **Project summaries**: See time breakdown by project +- **Export options**: CSV and JSON formats for integration with other tools + +### Local & Private +All data is stored locally in `~/.tmpo/tmpo.db` using SQLite. Your time tracking data never leaves your machine. + +## Configuration + +### Global Storage Location +``` +~/.tmpo/ + └── tmpo.db # SQLite database with all time entries +``` + +### Project Configuration (`.tmporc`) +Place a `.tmporc` file in your project root for custom settings: + +```yaml +project_name: My Awesome Project +hourly_rate: 125.50 +description: Client project for Acme Corp +``` + +The `.tmporc` file is automatically detected when you run `tmpo start` from within the project directory or any subdirectory. + +## Development + +### Building + +```bash +# Build for local development +go build -o tmpo . + +# Run tests +go test -v ./... + +# Build with goreleaser (for releases) +goreleaser build --snapshot --clean +``` + +### Project Structure + +``` +tmpo/ +β”œβ”€β”€ cmd/ # CLI commands (Cobra) +β”‚ β”œβ”€β”€ start.go +β”‚ β”œβ”€β”€ stop.go +β”‚ β”œβ”€β”€ status.go +β”‚ └── ... +β”œβ”€β”€ internal/ +β”‚ β”œβ”€β”€ config/ # Configuration management +β”‚ β”œβ”€β”€ storage/ # SQLite database layer +β”‚ β”œβ”€β”€ project/ # Project detection logic +β”‚ └── export/ # Export functionality +└── main.go +``` + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## Acknowledgments + +Built with: +- [Cobra](https://github.com/spf13/cobra) - CLI framework +- [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) - Pure Go SQLite driver +- [promptui](https://github.com/manifoldco/promptui) - Interactive prompts + +--- + +

Made with ❀️ by Dylan Ravel and you!

From 9522a58db6b8f5121f2fc5b863eb2906fca7cd60 Mon Sep 17 00:00:00 2001 From: Dylan Ravel <48571264+DylanDevelops@users.noreply.github.com> Date: Mon, 15 Dec 2025 13:33:58 -0700 Subject: [PATCH 5/7] Revise README with new screenshot and TOC structure Updated the README to include a screenshot and reorganized the table of contents. --- README.md | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0b18374..62017fe 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,18 @@ # tmpo CLI -Set the `tmpo` β€” A minimal CLI time tracker for developers. +> Set the `tmpo` β€” A minimal CLI time tracker for developers. - -

- tmpo Logo -

+![screenshot of tmpo start and tmpo stats](https://github.com/user-attachments/assets/6480b22a-e148-4142-9cb8-0b4ef1007430) `tmpo` allows you to track time effortlessly with automatic project detection and simple commands that live in your terminal. ## Table of Contents -* [Getting Started](#getting-started) - * [Installation](#installation) -* [Usage Examples](#usage-examples) -* [Contributing](#contributing) -* [License](#license) - -

- Installation β€’ - Usage β€’ - Features β€’ - Configuration β€’ - License -

+1. [Installation](#installation) +2. [Usage](#usage) +3. [Features](#features) +4. [Configuration](#configuration) +5. [License](#license) --- From e8fe0eba9dbfb7f976fb880d59acea6d6adb3e72 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 15 Dec 2025 15:08:35 -0700 Subject: [PATCH 6/7] Update README.md --- README.md | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 62017fe..a892c92 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ ## Table of Contents -1. [Installation](#installation) -2. [Usage](#usage) -3. [Features](#features) -4. [Configuration](#configuration) -5. [License](#license) +1. [Installation](#installation) +2. [Usage](#usage) +3. [Features](#features) +4. [Configuration](#configuration) +5. [License](#license) --- @@ -79,7 +79,9 @@ tmpo stats ### Basic Commands #### `tmpo start [description]` + Start tracking time for the current project. Automatically detects the project name from: + 1. `.tmporc` configuration file (if present) 2. Git repository name 3. Current directory name @@ -90,6 +92,7 @@ tmpo start "Fix authentication bug" # Start with description ``` #### `tmpo stop` + Stop the currently running time entry. ```bash @@ -97,6 +100,7 @@ tmpo stop ``` #### `tmpo status` + View the current tracking session with elapsed time. ```bash @@ -109,6 +113,7 @@ tmpo status ``` #### `tmpo log` + View your time tracking history. ```bash @@ -117,6 +122,7 @@ tmpo log --limit 50 # Show more entries ``` #### `tmpo stats` + Display statistics about your tracked time. ```bash @@ -128,6 +134,7 @@ tmpo stats --week # This week's stats ### Project Configuration #### `tmpo init` + Create a `.tmporc` configuration file for the current project. ```bash @@ -155,6 +162,7 @@ description: "" ### Advanced Features #### `tmpo manual` + Create manual time entries for past work using an interactive prompt. ```bash @@ -167,6 +175,7 @@ tmpo manual ``` #### `tmpo export` + Export your time tracking data to CSV or JSON. ```bash @@ -181,13 +190,17 @@ tmpo export --output timesheet.csv # Specify output file ## Features ### Automatic Project Detection + tmpo intelligently detects your project context: + - **`.tmporc` files**: Place a config file in your project root for explicit naming - **Git repositories**: Automatically uses the repository name - **Directory fallback**: Uses the current directory name ### Hourly Rate Tracking + Track billable hours with automatic earnings calculations: + ```bash tmpo init --rate 150 tmpo start "Client consultation" @@ -195,22 +208,26 @@ tmpo start "Client consultation" ``` ### Flexible Reporting + - **Daily/Weekly stats**: `tmpo stats --today` or `tmpo stats --week` - **Project summaries**: See time breakdown by project - **Export options**: CSV and JSON formats for integration with other tools ### Local & Private + All data is stored locally in `~/.tmpo/tmpo.db` using SQLite. Your time tracking data never leaves your machine. ## Configuration ### Global Storage Location + ``` ~/.tmpo/ └── tmpo.db # SQLite database with all time entries ``` ### Project Configuration (`.tmporc`) + Place a `.tmporc` file in your project root for custom settings: ```yaml @@ -270,6 +287,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file ## Acknowledgments Built with: + - [Cobra](https://github.com/spf13/cobra) - CLI framework - [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) - Pure Go SQLite driver - [promptui](https://github.com/manifoldco/promptui) - Interactive prompts From dce934b4ed9af51ecf91cb9de328750f47e6394e Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 15 Dec 2025 23:11:38 -0700 Subject: [PATCH 7/7] Add contributing guide and documentation Added CONTRIBUTING.md with contribution guidelines, and created docs/usage.md and docs/configuration.md for detailed usage and configuration instructions. Updated README.md to provide a concise overview, improved feature descriptions, and linked to the new documentation files. --- CONTRIBUTING.md | 195 ++++++++++++++++++++++++++++++++++ README.md | 242 +++--------------------------------------- docs/configuration.md | 238 +++++++++++++++++++++++++++++++++++++++++ docs/usage.md | 205 +++++++++++++++++++++++++++++++++++ 4 files changed, 655 insertions(+), 225 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 docs/configuration.md create mode 100644 docs/usage.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c380339 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,195 @@ +# Contributing to tmpo + +Thank you for your interest in contributing to tmpo! This document provides guidelines and instructions for contributing to the project. + +## Getting Started + +### Prerequisites + +- Go 1.21 or higher +- Git + +### Setting Up Your Development Environment + +1. [Fork](https://github.com/DylanDevelops/tmpo/fork) the repository +2. Clone your fork: + + ```bash + git clone https://github.com/YOUR_USERNAME/tmpo.git + cd tmpo + ``` + +3. Add the upstream repository: + + ```bash + git remote add upstream https://github.com/DylanDevelops/tmpo.git + ``` + +## Development Workflow + +### Building + +```bash +# Build for local development +go build -o tmpo . + +# Run the binary +./tmpo --help +``` + +### Testing + +```bash +# Run all tests +go test -v ./... + +# Run tests with coverage +go test -v -cover ./... +``` + +### Building Releases + +```bash +# Build with goreleaser (for testing release builds) +goreleaser build --snapshot --clean +``` + +## Project Structure + +``` +tmpo/ +β”œβ”€β”€ cmd/ # CLI commands (Using Cobra) +β”‚ β”œβ”€β”€ command1.go +β”‚ β”œβ”€β”€ command2.go +β”‚ β”œβ”€β”€ command3.go +β”‚ β”œβ”€β”€ ... +β”œβ”€β”€ internal/ +β”‚ β”œβ”€β”€ config/ # Configuration management (.tmporc files) +β”‚ β”œβ”€β”€ storage/ # SQLite database layer +β”‚ β”œβ”€β”€ project/ # Project detection logic +β”‚ └── export/ # Export functionality +β”œβ”€β”€ docs/ # User documentation +β”‚ β”œβ”€β”€ usage.md +β”‚ └── configuration.md +β”œβ”€β”€ main.go +└── README.md +``` + +### Key Directories + +- **`cmd/`**: Contains all CLI command implementations using Cobra +- **`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 +- **`docs/`**: User-facing documentation and guides + +### Data Storage + +All user data is stored locally in: + +``` +~/.tmpo/ + └── tmpo.db # SQLite database +``` + +The database schema includes: + +- Time entries (start/end times, project, description) +- Project metadata (derived from entries) +- Automatic indexing for fast queries + +### How Project Detection Works + +When a user runs `tmpo start`, the project name is detected in this priority order: + +1. **`.tmporc` file** - Searches current directory and all parent directories +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`. + +## Making Changes + +### Branching + +Create a feature branch from `main`: + +```bash +git checkout -b feature/your-feature-name +``` + +Use descriptive branch names such as: + +- `feature/add-pause-command` +- `fix/status-display-bug` +- `docs/update-readme` + +### Code Style + +- Follow standard Go conventions and use `gofmt` +- Write clear, descriptive commit messages +- Add comments for complex logic +- Keep functions focused and modular + +### Commit Messages + +Use clear, imperative commit messages: + +``` +Add pause/resume functionality + +- Implement pause command to temporarily stop tracking +- Add resume command to continue paused sessions +- Update status command to show paused state +``` + +## Submitting Changes + +1. Ensure all tests pass: `go test -v ./...` +2. Commit your changes with descriptive messages +3. Push to your fork: + + ```bash + git push origin feature/your-feature-name + ``` + +4. Open a Pull Request against the `main` branch +5. Describe your changes and link any related issues + +### Pull Request Guidelines + +- Provide a clear description of the changes +- Reference any related issues (e.g., "Fixes #123") +- Ensure tests pass and code builds successfully +- Be responsive to feedback and questions + +Reviews can take a few iterations, especially for large contributions. Don't be disheartened if you feel it takes time - we just want to ensure each contribution is high-quality and that any outstanding questions are resolved, captured or documented for posterity. + +## Reporting Issues + +When reporting bugs or requesting features, please: + +1. Check existing issues first to avoid duplicates +2. Use the issue templates provided +3. Include relevant details: + - tmpo version (`tmpo --version`) + - Operating system + - Steps to reproduce (for bugs) + - Expected vs actual behavior + +## Questions? + +Feel free to [open an issue](https://github.com/DylanDevelops/tmpo/issues/new/choose) for questions or discussions about: + +- Feature ideas +- Implementation approaches +- Project architecture + +## Code of Conduct + +Be respectful and constructive in all interactions. We're all here to make tmpo better! + +--- + +Thank you for contributing to tmpo! diff --git a/README.md b/README.md index a892c92..df5f2d9 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,7 @@ ![screenshot of tmpo start and tmpo stats](https://github.com/user-attachments/assets/6480b22a-e148-4142-9cb8-0b4ef1007430) -`tmpo` allows you to track time effortlessly with automatic project detection and simple commands that live in your terminal. - -## Table of Contents - -1. [Installation](#installation) -2. [Usage](#usage) -3. [Features](#features) -4. [Configuration](#configuration) -5. [License](#license) - ---- +**tmpo** allows you to track time effortlessly with simple commands that live in your terminal. Track time with automatic project detection, view stats, and export data; all without leaving your workspace. ## About @@ -23,17 +13,16 @@ ### Why tmpo? - **πŸš€ Fast & Lightweight** - Built in Go, tmpo starts instantly and uses minimal resources -- **🎯 Automatic Project Detection** - Detects project names from Git repos or `.tmporc` files -- **πŸ’Ύ Local Storage** - All data stored locally in SQLite - your time tracking stays private +- **🎯 Automatic Project Detection** - Detects project names from Git repos or `.tmporc` configuration files +- **πŸ’Ύ Local & Private Storage** - All data stored locally in SQLite - your time tracking stays private - **πŸ“Š Rich Reporting** - View stats, export to CSV/JSON, and track hourly rates -- **⚑ Zero Configuration** - Works out of the box, configure only when you need to +- **⚑ Zero Configuration Needed** - Works out of the box, configure only when you need to ## Installation ### Homebrew (macOS/Linux) ```bash -# Coming soon brew install tmpo ``` @@ -55,11 +44,11 @@ go build -o tmpo . # Initialize an optional configuration file tmpo init -# Start tracking time (auto-detects project from git/directory) +# Start tracking (auto-detects project) tmpo start -# Start with a description -tmpo start "Implementing user authentication" +# Add a description +tmpo start "Fixing auth bug" # Check current status tmpo status @@ -67,231 +56,34 @@ tmpo status # Stop tracking tmpo stop -# View your time log -tmpo log - -# See statistics +# View statistics tmpo stats ``` -## Usage - -### Basic Commands - -#### `tmpo start [description]` - -Start tracking time for the current project. Automatically detects the project name from: - -1. `.tmporc` configuration file (if present) -2. Git repository name -3. Current directory name - -```bash -tmpo start # Start tracking -tmpo start "Fix authentication bug" # Start with description -``` - -#### `tmpo stop` - -Stop the currently running time entry. - -```bash -tmpo stop -``` - -#### `tmpo status` - -View the current tracking session with elapsed time. - -```bash -tmpo status -# Output: -# [tmpo] Currently tracking: my-project -# Started: 2:30 PM -# Duration: 1h 23m -# Description: Implementing feature -``` - -#### `tmpo log` - -View your time tracking history. - -```bash -tmpo log # Show recent entries -tmpo log --limit 50 # Show more entries -``` - -#### `tmpo stats` - -Display statistics about your tracked time. - -```bash -tmpo stats # All-time stats -tmpo stats --today # Today's stats -tmpo stats --week # This week's stats -``` - -### Project Configuration - -#### `tmpo init` - -Create a `.tmporc` configuration file for the current project. - -```bash -tmpo init # Auto-detect project name -tmpo init --name "My Project" # Specify name -tmpo init --name "Client Work" --rate 150 # Set hourly rate -``` - -This creates a `.tmporc` file: - -```yaml -# tmpo project configuration -# This file configures time tracking settings for this project - -# Project name (used to identify time entries) -project_name: My Project - -# [OPTIONAL] Hourly rate for billing calculations (set to 0 to disable) -hourly_rate: 150.00 - -# [OPTIONAL] Description for this project -description: "" -``` - -### Advanced Features - -#### `tmpo manual` - -Create manual time entries for past work using an interactive prompt. - -```bash -tmpo manual -# Prompts for: -# - Project name -# - Start date and time -# - End date and time -# - Description -``` - -#### `tmpo export` - -Export your time tracking data to CSV or JSON. - -```bash -tmpo export # Export all as CSV -tmpo export --format json # Export as JSON -tmpo export --project "My Project" # Filter by project -tmpo export --today # Export today's entries -tmpo export --week # Export this week -tmpo export --output timesheet.csv # Specify output file -``` - -## Features - -### Automatic Project Detection - -tmpo intelligently detects your project context: - -- **`.tmporc` files**: Place a config file in your project root for explicit naming -- **Git repositories**: Automatically uses the repository name -- **Directory fallback**: Uses the current directory name - -### Hourly Rate Tracking - -Track billable hours with automatic earnings calculations: - -```bash -tmpo init --rate 150 -tmpo start "Client consultation" -# When you stop, tmpo shows estimated earnings -``` - -### Flexible Reporting - -- **Daily/Weekly stats**: `tmpo stats --today` or `tmpo stats --week` -- **Project summaries**: See time breakdown by project -- **Export options**: CSV and JSON formats for integration with other tools - -### Local & Private - -All data is stored locally in `~/.tmpo/tmpo.db` using SQLite. Your time tracking data never leaves your machine. +For detailed usage and all commands, see the [Usage Guide](docs/usage.md). ## Configuration -### Global Storage Location - -``` -~/.tmpo/ - └── tmpo.db # SQLite database with all time entries -``` - -### Project Configuration (`.tmporc`) - -Place a `.tmporc` file in your project root for custom settings: - -```yaml -project_name: My Awesome Project -hourly_rate: 125.50 -description: Client project for Acme Corp -``` - -The `.tmporc` file is automatically detected when you run `tmpo start` from within the project directory or any subdirectory. - -## Development - -### Building +Optionally, but highly recommended, create a `.tmporc` file in your project to customize the project name and hourly rate: ```bash -# Build for local development -go build -o tmpo . - -# Run tests -go test -v ./... - -# Build with goreleaser (for releases) -goreleaser build --snapshot --clean +tmpo init --name "My Project" --rate 25.50 ``` -### Project Structure +See the [Configuration Guide](docs/configuration.md) for details. -``` -tmpo/ -β”œβ”€β”€ cmd/ # CLI commands (Cobra) -β”‚ β”œβ”€β”€ start.go -β”‚ β”œβ”€β”€ stop.go -β”‚ β”œβ”€β”€ status.go -β”‚ └── ... -β”œβ”€β”€ internal/ -β”‚ β”œβ”€β”€ config/ # Configuration management -β”‚ β”œβ”€β”€ storage/ # SQLite database layer -β”‚ β”œβ”€β”€ project/ # Project detection logic -β”‚ └── export/ # Export functionality -└── main.go -``` +## Feedback -## Contributing +Found a bug or have an idea for a feature you'd like to see in tmpo? [Open an issue](https://github.com/DylanDevelops/tmpo/issues/new/choose) and our team will be able to help. -Contributions are welcome! Please feel free to submit a Pull Request. +## Contributing -1. Fork the repository -2. Create your feature branch (`git checkout -b feature/amazing-feature`) -3. Commit your changes (`git commit -m 'Add some amazing feature'`) -4. Push to the branch (`git push origin feature/amazing-feature`) -5. Open a Pull Request +Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -## Acknowledgments - -Built with: - -- [Cobra](https://github.com/spf13/cobra) - CLI framework -- [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) - Pure Go SQLite driver -- [promptui](https://github.com/manifoldco/promptui) - Interactive prompts - --- -

Made with ❀️ by Dylan Ravel and you!

+Made with ❀️ by [Dylan Ravel](https://github.com/DylanDevelops) and you! diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..90a086b --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,238 @@ +# Configuration Guide + +Learn how to configure tmpo for your projects and workflow. + +## Storage Location + +All time tracking data is stored locally on your machine: + +``` +~/.tmpo/ + └── tmpo.db # SQLite database +``` + +Your data never leaves your machine. The database file can be backed up, copied, or version controlled if desired. + +## Project Configuration + +### The `.tmporc` File + +Place a `.tmporc` file in your project root to customize tracking settings for that project. When you run tmpo commands from within the project directory (or any subdirectory), it will automatically use these settings. + +### Creating a Configuration File + +Use `tmpo init` to create a `.tmporc` file interactively: + +```bash +cd ~/projects/my-project +tmpo init --name "My Project" --rate 150 +``` + +This creates a `.tmporc` file in the current directory. + +### File Format + +The `.tmporc` file uses YAML format: + +```yaml +# tmpo project configuration +# This file configures time tracking settings for this project + +# Project name (used to identify time entries) +project_name: My Awesome Project + +# [OPTIONAL] Hourly rate for billing calculations (set to 0 to disable) +hourly_rate: 125.50 + +# [OPTIONAL] Description for this project +description: Client project for Acme Corp +``` + +### Configuration Fields + +#### `project_name` (required) + +The name used to identify time entries for this project. This overrides automatic detection from git or directory names. + +**Example:** + +```yaml +project_name: Client Website Redesign +``` + +#### `hourly_rate` (optional) + +Your billing rate in dollars per hour. When set, tmpo will calculate estimated earnings based on tracked time. + +**Example:** + +```yaml +hourly_rate: 150.00 +``` + +Set to `0` or omit to disable rate tracking: + +```yaml +hourly_rate: 0 +``` + +#### `description` (optional) + +A longer description or notes about the project. This is for your reference and doesn't affect time tracking. + +**Example:** + +```yaml +description: Q1 2024 website redesign for Acme Corp. Main contact: john@acme.com +``` + +## Project Detection Priority + +When you run `tmpo start`, the project name is determined in this order: + +1. **`.tmporc` file** - If present in current directory or any parent directory +2. **Git repository name** - The name of the git repository root folder +3. **Current directory name** - The name of your current working directory + +This means you can override automatic detection by adding a `.tmporc` file. + +### Example Scenarios + +#### **Scenario 1:** Git repo with custom name + +```bash +# Directory: ~/code/website-2024/ +# Git repo name: website-2024 +# No .tmporc file +tmpo start +# β†’ Tracks to project "website-2024" +``` + +#### **Scenario 2:** With .tmporc override + +```bash +# Directory: ~/code/website-2024/ +# .tmporc contains: project_name: "Acme Website" +tmpo start +# β†’ Tracks to project "Acme Website" +``` + +#### **Scenario 3:** Subdirectory detection + +```bash +# Directory: ~/code/my-project/src/components/ +# .tmporc exists at: ~/code/my-project/.tmporc +tmpo start +# β†’ Uses .tmporc from project root +``` + +## Multi-Project Setup + +### Separate Projects with Different Rates + +Create a `.tmporc` in each project directory: + +```bash +# Client A - $150/hour +cd ~/projects/client-a +cat > .tmporc << EOF +project_name: Client A - Web Development +hourly_rate: 150.00 +EOF + +# Client B - $175/hour +cd ~/projects/client-b +cat > .tmporc << EOF +project_name: Client B - Game Development +hourly_rate: 175.00 +EOF + +# Personal project - no billing +cd ~/projects/my-app +cat > .tmporc << EOF +project_name: My App +hourly_rate: 0 +EOF +``` + +### Monorepo with Sub-Projects + +In a monorepo, you can track different sub-projects separately: + +```bash +# Main repo tracks to "My Company Platform" +cd ~/monorepo +echo "project_name: My Company Platform" > .tmporc + +# But frontend team tracks separately +cd ~/monorepo/frontend +echo "project_name: Platform - Frontend" > .tmporc + +# And backend team tracks separately +cd ~/monorepo/backend +echo "project_name: Platform - Backend" > .tmporc +``` + +## Version Control + +### Should I commit `.tmporc`? + +**Yes, commit it** *if*: + +- Your team wants shared project naming +- It's an open source project and contributors might want to track time +- The configuration has no sensitive information + +**Don't commit it** *if*: + +- The hourly rate is personal/confidential +- Each team member prefers their own project naming + +### Using `.gitignore` + +To keep `.tmporc` files local: + +```bash +echo ".tmporc" >> .gitignore +``` + +Or create a global gitignore: + +```bash +echo ".tmporc" >> ~/.gitignore_global +git config --global core.excludesfile ~/.gitignore_global +``` + +## Migrating Data + +### Backing Up Your Data + +```bash +# Create a backup of your time tracking database +cp ~/.tmpo/tmpo.db ~/backups/tmpo-backup-$(date +%Y%m%d).db +``` + +### Moving to a New Machine + +```bash +# On old machine +cp ~/.tmpo/tmpo.db ~/tmpo-export.db + +# Transfer file to new machine, then: +mkdir -p ~/.tmpo +cp ~/tmpo-export.db ~/.tmpo/tmpo.db +``` + +### Exporting for External Tools + +Use `tmpo export` to get your data in portable formats: + +```bash +# Export everything to CSV +tmpo export --output all-time-data.csv + +# Export to JSON for programmatic access +tmpo export --format json --output all-time-data.json +``` + +See the [Usage Guide](usage.md#tmpo-export) for more export options. diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..258b915 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,205 @@ +# Usage Guide + +Complete reference for all tmpo commands and features. + +## Basic Commands + +### `tmpo start [description]` + +Start tracking time for the current project. Automatically detects the project name from: + +1. `.tmporc` configuration file (if present) +2. Git repository name +3. Current directory name + +**Examples:** + +```bash +tmpo start # Start tracking +tmpo start "Fix authentication bug" # Start with description +``` + +### `tmpo stop` + +Stop the currently running time entry. + +```bash +tmpo stop +``` + +### `tmpo status` + +View the current tracking session with elapsed time. + +```bash +tmpo status +# Output: +# [tmpo] Currently tracking: my-project +# Started: 2:30 PM +# Duration: 1h 23m +# Description: Implementing feature +``` + +### `tmpo log` + +View your time tracking history. + +**Options:** + +- `--limit N` - Show N most recent entries (default: 20) + +**Examples:** + +```bash +tmpo log # Show recent entries +tmpo log --limit 50 # Show more entries +``` + +### `tmpo stats` + +Display statistics about your tracked time. + +**Options:** + +- `--today` - Show only today's statistics +- `--week` - Show this week's statistics +- `--month` - Show this month's statistics + +**Examples:** + +```bash +tmpo stats # All-time stats +tmpo stats --today # Today's stats +tmpo stats --week # This week's stats +``` + +## Project Configuration + +### `tmpo init` + +Create a `.tmporc` configuration file for the current project. + +**Options:** + +- `--name "Project Name"` - Specify custom project name +- `--rate 150` - Set hourly rate for billing calculations + +**Examples:** + +```bash +tmpo init # Auto-detect project name +tmpo init --name "My Project" # Specify name +tmpo init --name "Client Work" --rate 150 # Set hourly rate +``` + +See [Configuration Guide](configuration.md) for details on the `.tmporc` file format. + +## Advanced Features + +### `tmpo manual` + +Create manual time entries for past work using an interactive prompt. + +```bash +tmpo manual +# Prompts for: +# - Project name +# - Start date and time +# - End date and time +# - Description +``` + +This is useful for: + +- Recording time before you started using tmpo +- Adding entries when you forgot to start the timer +- Correcting tracking mistakes + +### `tmpo export` + +Export your time tracking data to CSV or JSON. + +**Options:** + +- `--format [csv|json]` - Output format (default: csv) +- `--project "Name"` - Filter by specific project +- `--today` - Export only today's entries +- `--week` - Export this week's entries +- `--month` - Export this month's entries +- `--output filename` - Specify output file path + +**Examples:** + +```bash +tmpo export # Export all as CSV +tmpo export --format json # Export as JSON +tmpo export --project "My Project" # Filter by project +tmpo export --today # Export today's entries +tmpo export --week # Export this week +tmpo export --output timesheet.csv # Specify output file +``` + +**CSV Format:** + +```csv +Project,Description,Start,End,Duration (hours) +my-project,Implementing feature,2024-01-15 14:30:00,2024-01-15 16:45:00,2.25 +``` + +**JSON Format:** + +```json +[ + { + "project": "my-project", + "description": "Implementing feature", + "start": "2024-01-15T14:30:00Z", + "end": "2024-01-15T16:45:00Z", + "duration_hours": 2.25 + } +] +``` + +## Tips and Workflows + +### Quick Daily Review + +```bash +# See what you worked on today +tmpo stats --today +tmpo log --limit 10 +``` + +### Weekly Timesheet Export + +```bash +# Export this week's entries for invoicing +tmpo export --week --output timesheet-$(date +%Y-%m-%d).csv +``` + +### Multi-Project Workflow + +Create a `.tmporc` file in each project directory with different hourly rates: + +```bash +cd ~/projects/client-a +tmpo init --name "Client A" --rate 150 + +cd ~/projects/client-b +tmpo init --name "Client B" --rate 175 +``` + +Now `tmpo start` will automatically track to the correct project when you're in each directory. + +### Tracking Without Descriptions + +You can always start tracking immediately and add context later by checking your git commits: + +```bash +tmpo start +# ... do work ... +tmpo stop + +# Later, correlate with git log to recall what you did +git log --since="2 hours ago" --oneline +```