Generate tweet drafts from git diffs and commit context.
Project description
diff2tweet
Stop forgetting to tweet about your code wins.
diff2tweet feeds your recent git commits and diffs to an LLM and generates a tweet draft. Run it after you push, review the candidates, and move on.
Install
pip install diff2tweet
For Anthropic or Gemini providers, install the extras you need:
pip install 'diff2tweet[anthropic]' # Claude
pip install 'diff2tweet[gemini]' # Gemini
pip install 'diff2tweet[all-providers]' # everything
Verify the install:
diff2tweet --help
Setup
1. Add your API key
Create a .env file in your repo root (or export the variable):
OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...
# GEMINI_API_KEY=...
All three providers are supported. Based on testing with gpt-5.1, claude-sonnet-4-6, and gemini-2.5-flash-lite-preview, Claude produced the best output quality. OpenAI was solid. Gemini struggled with context grounding. Your mileage may vary by model.
2. Add a config file
Create diff2tweet.yaml in your repo root. Minimal config:
provider: openai
model: gpt-4o
project_name: your-project
project_summary: One sentence about what your project does.
project_audience: Who you're building for.
project_stage: prototype # prototype | beta | launched
project_tone: technical # technical | founder | casual
A full annotated example is at diff2tweet.yaml in the repo.
Run
From anywhere inside your git repo:
diff2tweet
The tool will:
- Find your
diff2tweet.yamland.envat the repo root - Pull your recent committed changes since the last run
- Generate tweet candidates
- Save the result to
.diff2tweet/
Optional: Add context with NOTES.md
Drop a NOTES.md in your repo root to give the LLM extra context that wouldn't be visible in commits — what you're working toward, anything worth emphasizing, framing you want it to use. Gets included automatically.
Config Reference
| Key | Default | Description |
|---|---|---|
provider |
openai |
openai, anthropic, or gemini |
model |
— | Model name for the selected provider (required) |
project_name |
"" |
Project name for prompt context |
project_summary |
"" |
What the project does |
project_audience |
"" |
Who it's for |
project_stage |
prototype |
prototype, beta, or launched |
project_tone |
technical |
technical, founder, or casual |
project_key_terms |
[] |
Domain vocabulary to inform framing |
num_candidates |
1 |
Number of tweet drafts to generate |
character_limit |
280 |
Max tweet length |
lookback_commits |
5 |
Commits to include on first run |
commit_subject_min_chars |
20 |
Min chars for a commit subject to be included |
readme_max_chars |
0 |
Max README.md chars to include as context |
forced_hashtags |
[] |
Hashtags always included when they fit |
custom_instructions |
"" |
Extra guidance appended to the prompt |
context_max_chars |
12000 |
Max characters of context sent to the LLM |
max_doc_diff_sections |
3 |
Max documentation diff sections to include |
max_doc_section_chars |
1000 |
Max chars per individual doc diff section |
diff_ignore_patterns |
(list) | Glob patterns to exclude from diff context |
output_folder |
.diff2tweet |
Where logs and drafts are saved |
Output
Each run writes a markdown artifact to .diff2tweet/runs/ with the tweet candidates. Runs are also logged to .diff2tweet/run_log.jsonl so subsequent runs only pick up new commits.
Add .diff2tweet/ to your .gitignore, or commit it if you want a record of your tweet history.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diff2tweet-0.1.0.tar.gz.
File metadata
- Download URL: diff2tweet-0.1.0.tar.gz
- Upload date:
- Size: 25.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2d2c51a6fc83747a8fd9bc9e9494b0e286981987b839c5eee1c77a1e50455d3
|
|
| MD5 |
bf4c1ba55c26d41ee355b8706d1e6ec1
|
|
| BLAKE2b-256 |
4507997b14546020e1b477631f775c9d78ee0638e03bca9db44b8039f6e59032
|
File details
Details for the file diff2tweet-0.1.0-py3-none-any.whl.
File metadata
- Download URL: diff2tweet-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbb5b3c614ac09a764c77edf47ce256b083c4d893e94793290f9964f79425c64
|
|
| MD5 |
b1d3e7160f479200ede87617058fba15
|
|
| BLAKE2b-256 |
ffd4e0d4bf9ea0780edd8385d223b79c79c5c4673d76a1a4c8205b6868a7b01c
|