实用开源仓库维护工具:自动生成Changelog、PR描述、Issue打标。
我建这个用来自动化处理多个开源项目的日常重复劳动。它通过将 Git 历史和 GitHub API 结合大模型(OpenAI 或是本地免费 Ollama),让维护工作完全留在终端内。
Topics:
pythongithubmaintenancecli-toolopen-source
以下是使用 gardener 本身工具维护时的控制台真实输出情况:
自动生成真实日志 (gardener changelog):
$ gardener changelog --since 2026-03-01
## [0.3.1] - 2026-03-07
### Added
- GitHub API issue labeling command (`gardener issue-label`)
- Real CHANGELOG generation via `gardener changelog`
### Changed
- Refactored CLI entry point with Typer module自动生成 PR 摘要 (gardener pr-desc):
$ gardener pr-desc --branch feature/issue-label
## PR Summary
This PR introduces the new `issue-label` command and refactors the core LLM provider.
## Changes
- Added `label_issue` to `core.py`
- Registered `issue-label` in `cli.py`
- Configured GitHub API token fallback
## Impact
- Users can now triage issues directly from the CLI.- Changelog generation from git commit history
- PR descriptions generated from branch diffs
- Issue triage with automatic label suggestions
- Repository health stats — file counts, commit history, completeness scoring
- README analysis with improvement suggestions
- Template engine for standardized issue/PR/release documents
- Multi-backend LLM — OpenAI API or Ollama (local, free)
git clone https://github.com/uu1202hq-crypto/gardener.git
cd gardener
pip install -e .For development:
pip install -e ".[dev]"
pre-commit install# Check repo health
gardener stats
# Generate changelog since a date
gardener changelog --since 2026-01-01
# Generate PR description
gardener pr-desc --branch feature/new-command
# Suggest labels for an issue
gardener issue-label --title "App crashes on empty repo"
# README improvement suggestions
gardener readme-suggest --path README.md
# List available templates
gardener template list
# Triage open issues (dry run)
gardener triage --owner myuser --repo myprojectCopy .env.example to .env and fill in your keys:
cp .env.example .env| Variable | Default | Description |
|---|---|---|
OPENAI_API_KEY |
— | OpenAI API key |
OPENAI_MODEL |
gpt-4o-mini |
Model name |
OLLAMA_BASE_URL |
http://localhost:11434 |
Ollama URL |
GITHUB_TOKEN |
— | PAT for GitHub API commands |
If no OpenAI key is set, gardener automatically falls back to Ollama.
src/gardener/
├── cli.py # CLI commands (typer)
├── config.py # Environment config
├── core.py # Business logic
├── providers.py # LLM backends (OpenAI/Ollama)
├── analytics.py # Repo analysis & health scoring
├── github_client.py # GitHub REST API client
├── templates.py # Jinja2 template engine
└── utils.py # Shared helpers
# Run tests
pytest tests/ -v
# Lint
ruff check src/ tests/
# Type check
mypy src/gardener/MIT
