draftsman

module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: MIT

README ΒΆ

draftsman

GitHub go.mod Go version GitHub Workflow Status License

CLI tool that generates release notes from Conventional Commits, maintaining a continuously-updated draft release across GitHub, GitLab, Gitea, and Forgejo

✨ Features

  • Conventional Commits parsing β€” one changelog entry per commit, no PR metadata required, so it works identically for squash-merge, rebase-merge, and direct-push workflows.
  • Continuous draft releases β€” a live draft release is upserted on every push to the default branch (mirroring Release Drafter's model), finalized later via draftsman publish or the backend's own UI.
  • Multi-backend β€” GitHub, GitLab, Gitea, and Forgejo behind one common interface; switch backend with a single flag.
  • PR reference enrichment β€” best-effort PR linkage extracted from commit-message text (squash-merge trailers), with a live API fallback on GitHub where it's reliable.
  • Monorepo aware β€” map changed file paths to named Packages, each with its own changelog section (single mode) or its own independent Draft Release, version, and tag (multi mode).
  • Automatic SemVer β€” the next version is computed from the Conventional Commit types in range (breaking β†’ major, feat β†’ minor, fix/other β†’ patch); override it explicitly when needed.
  • Zero required config β€” sensible built-in defaults (category mapping, template, tag format) mean draftsman preview works in any repo with no .draftsman.yml at all.
  • Configurable β€” category β†’ section mapping, changelog template, tag format, and the skip-changelog trailer key are all overridable per repo.
  • Ships as a GitHub composite Action β€” no separate install step needed in a GitHub Actions workflow.

πŸš€ Quick Start

# Nix
nix run github:brpaz/draftsman -- --help

# Go
go install github.com/brpaz/draftsman/cmd/draftsman@latest

# Docker
docker run --rm -v "$(pwd):/repo" -w /repo ghcr.io/brpaz/draftsman:latest preview

Requires git on PATH; a backend API token is only needed for draft/publish, not preview.

Prebuilt binaries, prerequisites, and every install method in full: Installation.

πŸ”Œ Provider setup

GitHub, GitLab, Gitea, and Forgejo all work behind one common --backend flag. Token setup, --base-url, and CI examples per provider: Provider setup.

Usage

GitHub Action

A composite Action (action.yml at the repo root) wraps the CLI so a workflow can uses: it directly instead of hand-installing the binary.

Keep the draft release up to date on every push to the default branch:

name: Update draft release

on:
  push:
    branches: [main]

permissions:
  contents: write

jobs:
  draft:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 # full history β€” draftsman walks commits since the last tag
      - uses: brpaz/draftsman@v1
        with:
          command: draft
          backend: github
          token: ${{ secrets.GITHUB_TOKEN }}

Publish the draft on demand:

name: Publish release

on:
  workflow_dispatch:
    inputs:
      version:
        description: "Override the auto-computed version (optional)"
        required: false

permissions:
  contents: write

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: brpaz/draftsman@v1
        with:
          command: publish
          backend: github
          token: ${{ secrets.GITHUB_TOKEN }}
          version: ${{ inputs.version }}

--repo needs no input β€” it's read from the GITHUB_REPOSITORY environment variable GitHub Actions already sets on every runner.

For GitLab CI, Gitea Actions, and Forgejo Actions workflow examples (no composite Action exists for those β€” the binary/Docker image is used directly), see the provider guides linked above.

CLI

Three commands, all reading the current directory as the git repo:

Command What it does
draftsman preview Computes and prints release notes to stdout β€” no backend credentials required.
draftsman draft Upserts the draft release(s) on the backend with entries computed since the last release.
draftsman publish Promotes the draft release to published and tags it.
draftsman preview
draftsman draft --backend github --token "$GITHUB_TOKEN" --repo owner/repo
draftsman publish --backend github --token "$GITHUB_TOKEN" --repo owner/repo --version 1.2.0

Full flag reference (including env var equivalents, --package, and multi-mode behavior): CLI reference.

Configuration

An optional .draftsman.yml at the repo root overrides any built-in default β€” every field is optional:

mode: multi # single (default) | multi

categories:
  - type: feat
    section: Features
  - type: fix
    section: Bug Fixes

packages:
  - path: packages/api
    name: API
  - path: packages/web
    name: Web

skip-changelog-trailer: Skip-Changelog
tag-format: "{{package}}/v{{version}}"

Full field reference and the built-in default template: Configuration.

πŸ“š Documentation

Full documentation, including architecture and design decisions, lives under docs/ and is published as a static site at brpaz.github.io/draftsman (built with Zensical):

Coming from release-drafter? See the migration guide, or let an agent do the translation β€” a Claude Code skill is included:

npx skills add brpaz/draftsman --skill migrate-from-release-drafter --agent claude-code

🀝 Contributing

All contributions are welcome. Please check CONTRIBUTING.md for details.

🫢 Support

If you find this project helpful and would like to support its development, there are a few ways you can contribute:

Sponsor me on GitHub

Buy Me A Coffee

πŸ‘± Contributors

❀️ Acknowledgements

πŸ“ƒ License

Distributed under the MIT License. See LICENSE file for details.

πŸ“© Contact

Directories ΒΆ

Path Synopsis
cmd
draftsman command
internal
app
backend
Package backend defines the interface every git hosting adapter (GitHub, GitLab, Gitea, Forgejo) implements identically.
Package backend defines the interface every git hosting adapter (GitHub, GitLab, Gitea, Forgejo) implements identically.
backend/forgejo
Package forgejo implements backend.Backend against the Forgejo REST API (api/v1).
Package forgejo implements backend.Backend against the Forgejo REST API (api/v1).
backend/gitea
Package gitea implements backend.Backend against the Gitea REST API (api/v1), which is close enough to GitHub's release API in shape (tag_name/name/body/draft) that the adapter logic mirrors internal/backend/github β€” the differences are the base path, the Authorization header scheme, and list pagination's query param names.
Package gitea implements backend.Backend against the Gitea REST API (api/v1), which is close enough to GitHub's release API in shape (tag_name/name/body/draft) that the adapter logic mirrors internal/backend/github β€” the differences are the base path, the Authorization header scheme, and list pagination's query param names.
backend/github
Package github implements backend.Backend against the GitHub REST API.
Package github implements backend.Backend against the GitHub REST API.
backend/gitlab
Package gitlab implements backend.Backend against the GitLab Releases API.
Package gitlab implements backend.Backend against the GitLab Releases API.
commands/draft
Package draft implements the "draft" command: compute entries since the last release and upsert the draft release(s) on the backend.
Package draft implements the "draft" command: compute entries since the last release and upsert the draft release(s) on the backend.
commands/preview
Package preview implements the "preview" command: compute entries since the last release and print the resulting notes to stdout, without touching the backend.
Package preview implements the "preview" command: compute entries since the last release and print the resulting notes to stdout, without touching the backend.
commands/publish
Package publish implements the "publish" command: promote a draft release to published, tagging it on the backend.
Package publish implements the "publish" command: promote a draft release to published, tagging it on the backend.
commands/shared
Package shared provides flags common to multiple draftsman commands.
Package shared provides flags common to multiple draftsman commands.
commit
Package commit parses Conventional Commit messages.
Package commit parses Conventional Commit messages.
config
Package config loads and defaults a repo's .draftsman.yml.
Package config loads and defaults a repo's .draftsman.yml.
engine
Package engine computes a release Plan from a repository's commit history.
Package engine computes a release Plan from a repository's commit history.
git
Package git reads commit history from a local repository.
Package git reads commit history from a local repository.
version
Package version parses and increments SemVer versions, and matches them against a configurable tag-format template.
Package version parses and increments SemVer versions, and matches them against a configurable tag-format template.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL