git-fikatime
v1.0.0
Published
**Your friendly CLI that checks how many Git commits you’ve made in the last couple of hours and gently reminds you to take a well-deserved fika break.**
Readme
fikatime
Your friendly CLI that checks how many Git commits you’ve made in the last couple of hours and gently reminds you to take a well-deserved fika break.
Fika — a cherished Swedish tradition of pausing for coffee, treats, and good company — is an essential ritual to keep you energized and motivated while coding. This tool scans your recent Git commits and tells you if you might be overdoing it, encouraging you to step away for some fresh air, coffee, or a moment of mindfulness.
Table of Contents
Features
- Commit Analysis: Looks at how many commits you’ve pushed in the last 2 hours.
- Smart Time Check: If your coding session (earliest → latest commit) exceeds 60 minutes or you have 10+ commits, it suggests a break.
- ASCII Coffee Vibes: A motivational ASCII banner to lighten your mood.
- Simple & Friendly: Minimal overhead, quick to run, easy to integrate into any workflow.
Installation
Install globally (recommended):
npm install -g fikatimeOr run directly via
npx(no install needed):npx fikatime --testOr clone the repo and build from source (if you want to hack on it):
git clone https://github.com/yourusername/fikatime.git cd fikatime npm install npm run build
Usage
If installed globally:
fikatime- Checks the last 2 hours of commits in the current Git repo.
- If you’re coding non-stop, you’ll see a friendly ASCII reminder to take a break.
- If you’re pacing well, you’ll get a pat on the back.
(Make sure you’re in a directory that’s a valid Git repo!)
Typical command:
fikatime --testShows an ASCII “FIKA TIME” preview, ignoring actual Git data. Great for verifying you installed everything correctly.
How It Works
- Scans your Git log for commits in the last 2 hours using:
git log --since="2 hours ago" --pretty=format:"%H|%aI|%s" - Calculates:
- The count of commits
- The time difference (in minutes) between the earliest & latest commits
- Checks:
- If
count >= 10orminutes > 60, it prints a special ASCII banner suggesting you enjoy a Fika break. - Otherwise, it encourages you to keep going at a nice pace.
- If
Configuration
For now, thresholds are hardcoded:
if (count >= 10 || minutes > 60) {
// Time for a Fika!
}If you want to tweak that logic (e.g., 5 commits or 30 minutes), open src/fikatime.ts (or wherever your main code is) and modify the values in the showRecommendation function. Rebuild and enjoy your custom threshold!
Demo Mode
Use --test to see the ASCII “FIKA TIME” banner without scanning commits:
fikatime --testThis is purely for fun or to ensure your installation is working properly.
FAQ
Why does it say “Failed to read Git commits” in some repos?
Likely because you’re not in a repo that has commits in the past 2 hours, or your HEAD is in a detached state. Switch to a branch and try again.How do I change the ASCII art or messages?
The art is generated by libraries like figlet or ASCII strings in the code. Just open the code, swap in your own text, and recompile.Can I run this as part of my CI or pre-commit hook?
Sure, but it’s probably more of a local, personal comfort tool than a production CI. Still, you do you!Does it support Windows, Mac, Linux?
Yes. As long as you have Node and Git installed, it should work on any OS.
Contributing
We welcome any bug reports, new feature suggestions, or creative ASCII art expansions! To contribute:
- Fork the repo.
- Make changes on a new branch.
- Test thoroughly (
npm run build&&node dist/fikatime.js --test). - Submit a pull request.
We’re always open to improvements, especially new break ideas or funny ASCII messages.
License
Feel free to use, modify, or distribute this code. Just don’t forget to take your own Fika break from time to time. Caffeine and a little rest can do wonders for your code quality and sanity!
Enjoy fikatime!
Take care of your mental well-being during those intense coding sessions. Give your mind a rest, savor a snack, maybe have a little chat. After all, la vida é curta, and coffee breaks are essential to keep that developer momentum going.
Skål! (Cheers!) May your commits be green and your breaks be invigorating.
