DEV Community

Avery Lin
Avery Lin

Posted on

A Commit Digest That Runs on a Free Server

Friday evening. The solo founder closes the laptop. Three branches are open. Two bug reports sit in the inbox. One memory of what happened on Tuesday is already fading.

The next morning, the commit history tells the story. Reading it takes twenty minutes. Summarizing it takes another ten. Writing a status update for investors takes forever.

That is a waste. The fix is a small service on a free server. It reads the git log. It asks a free model to summarize. It delivers one clean message. The bill is zero.

The Free Server Math

MonkeyCode offers free model access and a free server tier. Disclosure: This article was prepared as part of MonkeyCode's product outreach. That combination turns a throwaway idea into a permanent utility.

A laptop sleeps. A server does not. A free server is enough for one small script. That script can run on a cron schedule. It can call a model API. It can post to a webhook. Nothing else is needed.

The Architecture

The service is a single Python file. It uses git to collect the last 24 hours of commits. It sends that raw text to a chat-completion endpoint. The endpoint returns a short digest. The script posts the digest to a Slack channel or a Telegram bot.

No database. No framework. No queue. Just a script, a config, and one cron line.

The Code

Here is a minimal version. It expects three environment variables: GIT_REPO, LLM_URL, and LLM_KEY. The URL and key point to whatever server you choose. MonkeyCode's free server is one option.

import os
import subprocess
import json
import urllib.request
from datetime import datetime, timedelta

repo = os.environ["GIT_REPO"]
url = os.environ["LLM_URL"]
key = os.environ["LLM_KEY"]

since = (datetime.now() - timedelta(hours=24)).isoformat()
log = subprocess.run(
    ["git", "-C", repo, "log", "--since=" + since, "--pretty=%h %s"],
    capture_output=True, text=True
).stdout

if not log.strip():
    print("No commits. Exiting.")
    exit(0)

prompt = f"Summarize this git log in three bullet points. Mention the main areas: {log}"

payload = {
    "model": "default",  # the server defines the actual name
    "messages": [
        {"role": "system", "content": "You write short status updates."},
        {"role": "user", "content": prompt}
    ]
}

req = urllib.request.Request(
    url,
    data=json.dumps(payload).encode(),
    headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}
)

with urllib.request.urlopen(req) as resp:
    data = json.load(resp)

digest = data["choices"][0]["message"]["content"]
print(digest)
Enter fullscreen mode Exit fullscreen mode

The script expects a chat-completion API shape. If the provider uses a different schema, adjust the payload. The structure above is enough for a weekend experiment.

Test Before You Schedule

Run the script on the local laptop first. Set the environment variables. Point GIT_REPO at any small repository. Check the output.

export GIT_REPO=/path/to/repo
export LLM_URL=https://your-server.example/v1/chat
export LLM_KEY=your-key
python3 digest.py
Enter fullscreen mode Exit fullscreen mode

A good test uses a single commit. A second test uses a merge. A third test uses an empty window. That last one should print the exit message. The script should never crash.

The Cron Line

The cron line is shorter than the script. It runs every morning at eight.

0 8 * * * cd /srv/digest && python3 digest.py >> digest.log 2>&1
Enter fullscreen mode Exit fullscreen mode

The log file captures the digest and any errors. A webhook can replace the print statement. Then the digest lands in the team channel.

Where the Free Tier Breaks

A free server has limits. It may fall asleep after idle time. The cron schedule helps, but a sleeping server delays the first run. Free model access also has rate limits. Long diffs may hit those limits.

The digest is best-effort. It can miss context. It cannot understand a broken test. It will not apologize for a missed deadline. That is acceptable for a status tool.

Who Should Not Use This

Teams with strict data rules should not send code to an external service. Anyone who needs guaranteed delivery should use a paid scheduler. Solo founders with small projects get the full benefit.

The approach works when the repo is small and the summary is short. It works when one missed digest is not a crisis. It works when the only cost is a few minutes of setup.

Ship Today

The setup takes ten minutes. The cost is zero. The value appears the next morning. That is the solo developer's math.

Use the free server for small utilities like this. Use the free model tokens for experiments. MonkeyCode fits that pattern, but the pattern matters more than the tool.

The next time the laptop closes, the digest is already waiting.

Top comments (0)