dart_bump 1.0.0
dart_bump: ^1.0.0 copied to clipboard
Automates Dart project version bumps using Git diffs and AI-generated CHANGELOG entries.
dart_bump #
dart_bump is a Dart automation tool for safe, consistent patch version bumps in Dart projects.
It integrates with Git and OpenAI to:
- Extract the current Git diff
- Generate a structured
CHANGELOG.mdentry - Increment the patch version in
pubspec.yaml - Update API version constants
- Keep releases consistent and low-effort
Designed for automation, CI usage, and developer tooling.
Features #
- 🔢 Automatic patch version bump (
x.y.z → x.y.(z+1)) - 🧩 Git diff extraction
- 📝 AI-generated, structured CHANGELOG entries
- 🔧 API version synchronization
- ♻️ Fully overridable logging
Usage #
Programmatic #
import 'dart:io';
import 'package:dart_bump/dart_bump.dart';
void main() async {
final bump = DartBump(
Directory.current,
Platform.environment['OPENAI_API_KEY'],
DartBump.defaultChangelogPrompt,
);
final result = await bump.bump();
print('New version: ${result?.version}');
}
CLI #
Activate the dart_bump command:
dart pub global activate dart_bump
dart_bump #
Run dart_bump to automatically bump the patch version, update CHANGELOG.md, and synchronize API constants.
dart_bump [--project-dir <path>] [--api-key <key>]
Options:
--project-dir <path>: Path to the Dart project (default: current directory)--api-key <key>: OpenAI API key (optional; defaults toOPENAI_API_KEYenvironment variable)-h, --help: Show help message
Example usage:
# Bump current project with OpenAI API key from env
dart_bump
# Bump a project in another directory
dart_bump --project-dir /path/to/project
# Bump with an explicit OpenAI API key
dart_bump --api-key YOUR_API_KEY
How It Works #
- Verifies the project is a Git repository
- Runs
git diffto extract changes - Sends the patch to ChatGPT to generate a CHANGELOG entry
- Increments the patch version in
pubspec.yaml - Prepends the entry to
CHANGELOG.md - Updates
lib/src/api_root.dart(if present)
All steps fail fast and log clearly.
Requirements #
- Git installed and available in PATH
- Dart 3.x+
- OpenAI API key (optional but recommended)
If no API key is provided, version bumping still works, but the changelog entry will be a placeholder.
Logging #
All output goes through:
void log(String message)
Override it to:
- Integrate with your logger
- Silence output
- Redirect logs to CI systems
Features and Bugs #
Please report issues and request features via the issue tracker.
Author #
Graciliano M. Passos: gmpassos@GitHub.
License #
Dart free & open-source license.