Work Summary Generator
Create easy-to-understand summaries of code changes for non-technical stakeholders and founders.
Key Features
-
Git Diff Analysis: The feature analyzes Git diffs representing code changes to generate comprehensive summaries.
-
Natural Language Summaries: Generates detailed summaries in plain language, making technical changes understandable to non-technical stakeholders.
-
Sectional Breakdown: Provides a structured summary including high-level overview, feature highlights, and impact analysis.
-
Social Media Integration: Automatically generates Twitter and LinkedIn posts based on the work summary.
-
Customizable Output: Allows customization of summary depth and focus areas based on stakeholder needs.
How it Works
- Provide a Git diff representing the code changes to be summarized.
- The tool uses advanced language models to analyze the diff and generate a detailed summary.
- The summary includes a high-level overview, sectional breakdown, plain language explanations, feature highlights, and impact analysis.
- The tool ensures a consistent, readable structure and can generate social media posts based on the summary.
You can find an example here (opens in a new tab)
Usage Guide
Here's a detailed step-by-step guide on how to use the Work Summary Generator:
-
Follow the initial setup guide here.
-
Create a new Python file and import the necessary modules:
from kaizen.reviewer.work_summarizer import WorkSummaryGenerator import requests from datetime import datetime, timedelta, timezone
-
Set up GitHub repository information and date range:
GITHUB_OWNER = "YourGitHubUsername" GITHUB_REPO_NAME = "YourRepoName" current_date = datetime.now(timezone.utc).date() since_date = current_date - timedelta(days=14) since_date_iso = since_date.isoformat()
-
Fetch commits and generate diff:
# Fetch commits commits_url = f"https://api.github.com/repos/{GITHUB_OWNER}/{GITHUB_REPO_NAME}/commits" params = {"since": since_date_iso} commits_response = requests.get(commits_url, params=params) commits = commits_response.json() # Generate diff first_commit_sha = commits[0]["sha"] last_commit_sha = commits[-1]["sha"] diff_url = f"https://api.github.com/repos/{GITHUB_OWNER}/{GITHUB_REPO_NAME}/compare/{last_commit_sha}...{first_commit_sha}" diff_response = requests.get(diff_url, headers={"Accept": "application/vnd.github.v3+json"}) diff_data = diff_response.json()
-
Extract file diffs:
file_diffs = [ { "file": file_dict["filename"], "patch": file_dict["patch"], "status": file_dict["status"], } for file_dict in diff_data["files"] if "patch" in file_dict ]
-
Generate work summary and social media posts:
work_summary_generator = WorkSummaryGenerator() result = work_summary_generator.generate_work_summaries(file_diffs, user="YourUsername") summary = result["summary"] twitter_post, * = work_summary_generator.generate_twitter_post(summary, user="YourUsername") linkedin_post, * = work_summary_generator.generate_linkedin_post(summary, user="YourUsername")
-
Display the results:
print(f"Work Summary:\n{summary}\n") print(f"Twitter Post:\n{twitter_post}\n") print(f"LinkedIn Post:\n{linkedin_post}\n")
-
Review the generated summary and social media posts, and share them with stakeholders as needed.
Example
To try out fast, here's a complete example to generate a work summary from GitHub commits:
from kaizen.reviewer.work_summarizer import WorkSummaryGenerator
import requests
from datetime import datetime, timedelta, timezone
# GitHub repository information
GITHUB_OWNER = "Cloud-Code-AI"
GITHUB_REPO_NAME = "kaizen"
# Get the current date and calculate the date 14 days ago
current_date = datetime.now(timezone.utc).date()
since_date = current_date - timedelta(days=14)
since_date_iso = since_date.isoformat()
# GitHub API endpoint for getting commits
commits_url = f"https://api.github.com/repos/{GITHUB_OWNER}/{GITHUB_REPO_NAME}/commits"
params = {"since": since_date_iso}
commits_response = requests.get(commits_url, params=params)
if commits_response.status_code != 200:
print("ERROR: Could not get GitHub commits")
exit(1)
commits = commits_response.json()
first_commit_sha = commits[0]["sha"]
last_commit_sha = commits[-1]["sha"]
# Get the diff between the first and last commits
diff_url = f"https://api.github.com/repos/{GITHUB_OWNER}/{GITHUB_REPO_NAME}/compare/{last_commit_sha}...{first_commit_sha}"
diff_response = requests.get(diff_url, headers={"Accept": "application/vnd.github.v3+json"})
diff_data = diff_response.json()
# Extract file diffs
file_diffs = [
{
"file": file_dict["filename"],
"patch": file_dict["patch"],
"status": file_dict["status"],
}
for file_dict in diff_data["files"]
if "patch" in file_dict
]
# Generate work summary
work_summary_generator = WorkSummaryGenerator()
result = work_summary_generator.generate_work_summaries(file_diffs, user="oss_example")
summary = result["summary"]
# Generate social media posts
twitter_post, * = work_summary_generator.generate_twitter_post(summary, user="oss_example")
linkedin_post, * = work_summary_generator.generate_linkedin_post(summary, user="oss_example")
# Display results
print(f"Work Summary:\n{summary}\n")
print(f"Twitter Post:\n{twitter_post}\n")
print(f"LinkedIn Post:\n{linkedin_post}\n")
Supported Input
- Git diffs
- GitHub repository information
Benefits
- Bridge the gap between technical and non-technical stakeholders
- Keep stakeholders engaged and informed about development progress
- Provide a user-friendly way for non-technical stakeholders to track development progress
- Streamline the reporting process with automatically generated work summaries
- Facilitate communication across different platforms with integrated social media post generation
Limitations
- AI Limitations: May not fully capture complex technical nuances or project-specific context.
- GitHub API Limitations: Rate limits and authentication requirements may affect large-scale usage.
- Summary Depth: The level of detail in summaries may vary based on the complexity of code changes.