@himpel/work-log
v0.1.2
Published
A starter for creating a TypeScript package.
Readme
work-log
📊 A CLI tool that tracks time spent in git branches using reflog analysis and displays results in a beautiful table format.
Features
- Time tracking: Automatically calculates time spent in each git branch today
- Git reflog analysis: Uses git reflog to track branch switches and calculate durations
- Beautiful output: Terminal table display using Ink React
- Real-time data: Shows current day's branch activity with last active times
- Zero configuration: Works out of the box in any git repository
Installation
# Clone and install dependencies
git clone <repo-url>
cd work-log
pnpm install
# Build the project
pnpm run build
# Run the CLI tool
pnpm run work-logUsage
Development Mode
# Run directly with tsx (development)
pnpm run work-logBuilt Version
# Run the built CLI tool
node dist/main.js
# Or use the npm script
pnpm startGlobal Installation (after publishing)
# Install globally
npm install -g work-log
# Run anywhere
work-logExample Output
📊 Git Branch Time Tracker - Today
Branch Time Last Active
────────────────────────────────────────
feature/login 2h 34m 14:23
main 1h 12m 16:45
bugfix/auth 45m 13:10
────────────────────────────────────────
Total 4h 31mHow It Works
- Reflog Analysis: Parses
git reflogto find branch checkout events from today - Time Calculation: Calculates duration between branch switches
- Data Aggregation: Sums up total time spent per branch
- Table Display: Uses Ink React to render a beautiful terminal table
Requirements
- Node.js (latest LTS recommended)
- Git repository (tool must be run inside a git repo)
- Branch switching activity (tool shows data for current day only)
Development
Setup
# Install dependencies
pnpm install
# Run in development mode
pnpm run devAvailable Scripts
pnpm run build- Build with tsdownpnpm run dev- Development mode with watchpnpm run test- Run tests with vitestpnpm run lint- Lint code with ESLintpnpm run format- Format code with Prettierpnpm run format:check- Check formattingpnpm run typecheck- TypeScript type checkingpnpm run work-log- Run CLI tool in development
Tech Stack
- Build Tool: tsdown
- Runtime: Node.js
- UI Framework: Ink (React for CLI)
- Git Operations: simple-git
- Language: TypeScript
- Testing: Vitest
- Linting: ESLint + Prettier
Code Conventions
- Use
typeinstead ofinterfacefor TypeScript - File naming: kebab-case (
work-log-app.tsx) - ESM modules with strict TypeScript
Contributing
- Fork the repository
- Create a feature branch
- Follow the code conventions in
CLAUDE.md - Run tests and linting:
pnpm run test && pnpm run lint - Submit a pull request
License
MIT
