Skip to content

Repository files navigation

Headroom

Keep license and copyright headers consistent across your source code.

CI Hackage version Stackage version BSD 3-Clause license

Headroom adds, updates, checks, and removes license headers in source code files. Define a header once as a Mustache template, keep its variables in a YAML configuration file, and apply it consistently across your project.

Headroom includes templates for popular open source licenses, understands the structure of selected source file types, and conservatively recognizes legacy headers from their license content.

Quick Start

Install Headroom with Homebrew, then initialize it in your project:

brew install norcane/tools/headroom
headroom init --license-type mit --source-path src

Review the variables generated in .headroom.yaml, preview the changes, and apply them:

headroom run --dry-run
headroom run

You can also verify that all headers are up to date without modifying any files, which is useful in CI:

headroom run --check-headers

See the Project Setup Guide for custom templates, multiple source directories, and other setup options.

How It Works

Given a template such as headroom-templates/python.mustache:

# Copyright (c) {{ year }} {{ author }}
# SPDX-License-Identifier: MIT

And variables in .headroom.yaml:

variables:
  author: "Jane Doe"
  year: "2026"

Headroom renders the header in each matching source file:

# Copyright (c) 2026 Jane Doe
# SPDX-License-Identifier: MIT

asciicast

Main Features

  • Safe header management — Add, replace, check, or remove owned headers while preserving unrelated source documentation and comments.
  • Built-in OSS licenses — Generate ready-to-use templates for popular open source licenses.
  • Flexible configuration — Control source paths, exclusions, margins, comment styles, and header placement through YAML.
  • Content-aware templates — Use information extracted from the processed file, such as a Java package name or Haskell module metadata.
  • Copyright year updates — Keep years and year ranges in copyright notices current.
  • Safe workflows — Preview changes with --dry-run, validate them in CI, and initialize projects without overwriting existing files.

Supported Licenses and File Types

Headroom includes templates for these licenses:

License Configuration value
Apache License 2.0 apache2
BSD 3-Clause bsd3
GNU GPL v2 gpl2
GNU GPL v3 gpl3
MIT mit
Mozilla Public License 2.0 mpl2

Supported file types include C, C++, CSS, Dart, Go, Haskell, HTML, Java, JavaScript, Kotlin, Nix, PHP, PureScript, Python, Rust, Scala, Shell, and XML. See the configuration reference for extensions and file-type-specific options.

Installation

Homebrew

brew install norcane/tools/headroom

Cabal

cabal install headroom

Pre-built Binaries

Pre-built x64 binaries for GNU/Linux and macOS are available on the releases page.

From Source

Headroom can be built with Cabal or Stack. See the installation guide for requirements and detailed instructions.

The master branch may contain changes that have not yet been published to Hackage. See the changelog for version details.

Documentation

Contributing

Bug reports and pull requests are welcome. You can open an issue or submit a pull request on GitHub.

To preview the documentation locally, run:

cd doc/microsite/
mkdocs serve

The microsite will be available at http://127.0.0.1:8000.

Adopters

Using Headroom in your project? Feel free to open an issue or submit a pull request to add it to this list.

Mentions

License

Headroom is distributed under the BSD 3-Clause License.

About

©️ Manager for license headers in source code files.

Topics

Resources

Stars

49 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages