reflect

Reflect

Reflect: An AI tool to generate your brag document

[!IMPORTANT] While this tool helps document your GitHub contributions, itโ€™s crucial to remember that your impact and value to a company extends far beyond whatโ€™s visible in GitHub. Many critical aspects of software engineering - such as mentoring, documentation, cross-team collaboration, and technical leadership - often happen outside of version control. For more on this topic, check out Glue Work, an excellent resource about the often-overlooked but essential work that makes teams successful.

Quickstart ๐Ÿš€

Prerequisites โš™๏ธ

  1. Install nodenv (preferred) or nvm
  2. Install npm or yarn package manager
  3. GitHub Personal Access Token (PAT) with repo and read:org scopes
  4. OpenAI API key (optional, for summary and brag document generation)

Usage ๐Ÿ’ป

  1. Set up your environment variables:
    cp .env{.example,}
    
  2. Run the setup script to configure your environment:
    ./script/setup
    
  3. Run the tool:
    ./reflect --username <github-username> --lookback <months-to-look-back> --brag
    

This will generate three markdown files in the output directory:

Features โœจ

Usage ๐Ÿ› ๏ธ

Run the tool:

./reflect --username <github-username> --lookback <months-to-look-back> [--brag]

Example:

./reflect --username bostonaholic --lookback 6 --brag

Arguments ๐Ÿ“‹

Required:

Optional:

Examples ๐Ÿš€

Basic usage:

./reflect --username bostonaholic --lookback 6 --brag

Choose a model:

./reflect --username bostonaholic --lookback 6 --model gpt-3-5-turbo --brag

Choose an LLM provider and model

./reflect --username bostonaholic --lookback 6 --provider anthropic --model claude-3-7-sonnet-20250219 --brag

Filter by specific organizations:

./reflect --username bostonaholic --lookback 6 --include-orgs shopify github

Exclude specific organizations:

./reflect --username bostonaholic --lookback 6 --exclude-orgs secret archived

Environment Variables ๐Ÿ”

Required environment variables:

To create a GitHub Personal Access Token:

  1. Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
  2. Generate a new token with the following scopes:
    • repo (Full control of private repositories)
    • read:org (Read organization data)
  3. Copy the token and add it to your .env file

Required for making LLM calls (one of):

Optional for using a different provider-compatible endpoint:

Security Considerations ๐Ÿ”’

Output ๐Ÿ“

The script will generate one or more markdown files in the output directory:

output/contributions.md ๐Ÿ“Š

Contains:

output/summarized_contributions.md (with โ€“brag flag) ๐Ÿ“

Contains:

output/brag_document.md (with โ€“brag flag) ๐ŸŽฏ

Contains:

Note: The output directory and all generated files are automatically git-ignored to prevent accidental commits.

Troubleshooting ๐Ÿ”

  1. If you get TypeScript errors, ensure youโ€™re using Node.js v22 or higher:
node --version
  1. If you get GitHub API errors:
    • Verify your GitHub Personal Access Token (PAT) is correctly set in your .env file
    • Check that your PAT has the required scopes (repo and read:org)
    • Ensure your PAT hasnโ€™t expired (they can be set to expire after a certain time)
    • Verify you have access to the repositories youโ€™re trying to fetch data from
  2. If the script runs but generates an empty file:
    • Check that you have activity in the specified time period
    • Verify your GitHub username is correct
    • Ensure you have the necessary permissions to access the repositories
  3. If you get an error about the OpenAI API key:
    • Make sure youโ€™ve set it in your .env file
    • Check that the API key is valid and has sufficient credits
    • Verify the .env file is in the correct location
  4. If you get environment variable errors:
    • Ensure your .env file exists and is properly formatted
    • Check that there are no spaces around the = sign in your .env file
    • Verify the .env file is in the root directory of the project