Skip to content

YvanY0/WorkMemories

Repository files navigation

WorkMemories: Automated Work Activity Reporter

WorkMemories Dashboard Python 3.12+ License: MIT

WorkMemories is a powerful command-line tool that automates the generation of detailed work activity reports with modern web UI. It aggregates data from GitHub, GitLab, Jira, and Google Calendar, providing a consolidated view of your contributions and meeting attendance over a specified period. Additionally, it leverages the Gemini AI to generate insightful summaries of your work.

Features

Multi-Platform Integration

  • GitHub: Tracks created/merged/updated pull requests, created issues, and review comments
  • GitLab: Monitors created/merged/updated merge requests and review comments
  • Jira: Follows created, missed, finished, and commented issues with automation project support
  • Google Calendar: Tracks attended meetings (only meetings you explicitly accepted)

Modern Web Dashboard

  • Interactive HTML Reports: Beautiful, responsive web interface with gradient cards and modern UI
  • Activity Summary Cards: Visual metrics dashboard showing key performance indicators
  • AI-Enhanced Tables: Integrated AI summaries directly in review tables
  • Multi-User Support: Multi-user overview with combined activity tracking
  • Dark/Light Theme: Automatic Nord theme switching support

AI-Powered Intelligence

  • Smart Summaries: Integrates with Google Gemini API for comprehensive work summaries
  • Review Analysis: AI-generated insights for individual pull/merge request reviews
  • Contextual Understanding: Intelligent categorization of work activities and contributions

Advanced Workflow Integration

  • Automated Jira Issues: Creates comprehensive review issues with AI summaries
  • Template System: Modular HTML template architecture for customization
  • Export Capabilities: JSON export and clipboard integration for easy sharing
  • Responsive Design: Mobile-friendly interface for viewing reports anywhere

Developer-Friendly Configuration

  • YAML Configuration: Flexible config.yaml with user-specific overrides
  • Environment Variables: Secure API token management
  • Async Processing: High-performance concurrent data fetching
  • Extensible Architecture: Modular design for easy feature additions

Quick Start

Prerequisites

Before you begin, ensure you have the following:

  • Python 3.12+ - Required for modern async features
  • uv package manager - Fast Python package installer
  • API tokens for GitHub, GitLab, Jira, and Gemini
  • Google Calendar API credentials (optional, for calendar integration)

Installation

  1. Clone the repository:

    git clone https://github.com/YvanY0/WorkMemories.git WorkMemories
    cd WorkMemories
  2. Set up environment:

    # Create virtual environment
    uv venv
    
    # Install dependencies
    uv sync
  3. Configure API tokens:

    Create a .env file in the project root:

    GITHUB_TOKEN="your_github_token"
    GITLAB_TOKEN="your_gitlab_token"
    JIRA_TOKEN="your_jira_token"
    GEMINI_API_KEY="your_gemini_api_key"
  4. Set up configuration:

    Create a config.yaml file with your platform details:

    github:
      site: https://api.github.com
      token:
        env: GITHUB_TOKEN
    
    gitlab:
      site: https://gitlab.example.com
      token:
        env: GITLAB_TOKEN
      groups:
        - "your-group"
    
    jira:
      site: https://issues.example.com
      token:
        env: JIRA_TOKEN
      auto_projects:
        - "AUTOMATION"
    
    google:
      gemini:
        token:
          env: GEMINI_API_KEY
    
    users:
      your_username:
        github:
          username: github_username
        jira:
          username: jira_username
  5. Run your first report:

    uv run work_memories.py -u your_username -s

Detailed Setup Guide

API Token Setup

GitHub Token Setup

  1. Go to GitHub Settings > Developer settings > Personal access tokens
  2. Click "Generate new token (classic)"
  3. Select scopes: repo, read:user, read:org
  4. Copy the generated token to your .env file

GitLab Token Setup

  1. Go to GitLab > User Settings > Access Tokens
  2. Create a personal access token with read_repository and read_user scopes
  3. Copy the token to your .env file

Jira Token Setup

  1. Go to Atlassian Account Settings > Security > API tokens
  2. Create a new API token
  3. Use your email and token for authentication in config

Google Gemini API Setup

Follow the Red Hat Gemini API Code Assistance User Guide for detailed instructions on obtaining your API key and adding it to your .env file as GEMINI_API_KEY.

Google Calendar Integration (Optional)

For calendar integration, set up OAuth credentials:

  1. Google Cloud Console Setup:

    • Go to Google Cloud Console
    • Create a new project or select existing
    • Enable the Google Calendar API
    • Create OAuth 2.0 credentials for desktop application
    • Download credentials as credentials.json
  2. Configuration:

    users:
      your_username:
        google:
          calendar:
            credentials_file: credentials.json
            token_file: token.json
  3. First Run: The app will open browser for OAuth authorization and create token.json automatically.

Project Structure

WorkMemories/
├── lib/                   # Core library modules
│   ├── calendar.py        # Google Calendar integration
│   ├── gemini.py          # AI summary generation
│   ├── git.py             # GitHub/GitLab API clients
│   ├── jira.py            # Jira integration
│   ├── report.py          # Report generation engine
│   └── utils.py           # Utility functions
├── templates/             # HTML template system
│   ├── components/        # Reusable UI components
│   ├── sections/          # Platform-specific sections
│   └── views/             # Page layouts
├── work_memories.py       # Main CLI application
├── config.yaml            # Configuration file
└── .env                   # Environment variables

Usage

Basic Commands

Generate reports using the command line interface. By default, it creates reports for the current month.

Single User Report

# Basic report for a user
uv run work_memories.py -u USERNAME

# With AI-powered summaries
uv run work_memories.py -u USERNAME -s

# Custom date range
uv run work_memories.py -u USERNAME -d 2025-01-01~2025-01-31

Multi-user Reports

# Generate reports for all configured users
uv run work_memories.py -a

# Report with AI summaries
uv run work_memories.py -a -s

Advanced Features

# Create Jira issue for reviewed patches (requires -s flag)
uv run work_memories.py -u USERNAME -s --create-jira-issue

# Specify custom config file
uv run work_memories.py -u USERNAME -c custom_config.yaml

Command Line Options

Option Description Example
-u, --user Generate report for specific user -u yihyu
-a, --all Generate reports for all users -a
-s, --summary Enable AI-powered summaries -s
-d, --date-range Custom date range -d 2025-01-01~2025-01-31
-c, --config Custom config file path -c config/custom.yaml
--create-jira-issue Create Jira issue for reviews --create-jira-issue

Output Files

The tool generates comprehensive reports in multiple formats:

  • work_memories_report.html - Interactive web dashboard with modern UI
  • work_memories_report.md - Markdown format for documentation
  • Browser auto-open - HTML report opens automatically for immediate viewing

Web Dashboard Features

The generated HTML report includes:

  • Activity Summary Cards - Visual metrics for each platform
  • Interactive Tables - Sortable data with AI insights
  • Theme Toggle - Dark/light mode switching
  • Responsive Design - Mobile-friendly interface
  • Export Options - JSON export and clipboard integration

Advanced Configuration

Multi-User Setup

Configure multiple users with different platform settings:

users:
  developer1:
    github:
      username: dev1_github
    jira:
      username: dev1@company.com
    gitlab:
      username: dev1_gitlab

  manager1:
    github:
      username: mgr1_github
    jira:
      username: manager1@company.com
      auto_projects:
        - "MANAGEMENT"
        - "PLANNING"

Platform-Specific Configurations

GitHub Enterprise

github:
  site: https://github.enterprise.com/api/v3
  token:
    env: GITHUB_ENTERPRISE_TOKEN

Self-Hosted GitLab

gitlab:
  site: https://gitlab.internal.company.com
  token:
    env: GITLAB_INTERNAL_TOKEN
  groups:
    - "internal-projects"

Jira Advanced Setup

jira:
  site: https://company.atlassian.net
  token:
    env: JIRA_TOKEN
  auto_projects:
    - "AUTOMATION"
    - "INFRASTRUCTURE"
  # Custom JQL queries (optional)
  custom_queries:
    my_issues: "assignee = currentUser() AND status != Closed"

Proxy Configuration

google:
  proxy: http://proxy.company.com:8080
  gemini:
    token:
      env: GEMINI_API_KEY

Contributing

We welcome contributions! Here's how to get started:

Development Setup

  1. Fork and clone the repository
  2. Set up development environment:
    uv venv
    uv sync
    pre-commit install

Project Architecture

  • lib/ - Core business logic modules
  • templates/ - Jinja2 templates for HTML generation
  • work_memories.py - CLI interface and main application logic

Adding New Features

  1. Platform Integration: Add new platform support in lib/
  2. UI Components: Create reusable templates in templates/components/
  3. Report Sections: Add platform-specific sections in templates/sections/

Coding Standards

  • Follow PEP 8 for Python code style
  • Use type hints for better code documentation
  • Add docstrings for public functions and classes

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • Google Gemini API for AI-powered summaries
  • GitHub/GitLab APIs for comprehensive activity tracking
  • Atlassian Jira API for issue management integration
  • Google Calendar API for meeting tracking

Star this repo if you find it useful!

Made with care for developers who want to track their productivity

About

WorkMemories: Automated Work Activity Reporter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors