Manage a project's open-source license in one command.
linim writes the root LICENSE file with the verbatim license text, records
the project's licensing decisions in a small committed .linim file, and
injects or updates SPDX-copyright headers at the top of every source file that
supports comments.
cargo build --release
# binary at target/release/linimlinim [OPTIONS] [PATH]
PATH defaults to the current directory.
| Option | Meaning |
|---|---|
--new |
Reconfigure from scratch, prompt for license and copyright, rewrite LICENSE, .linim, and every file's header. |
--no-headers |
Write or update LICENSE only. Do not touch source file headers. |
--verbose |
Emit one line per updated file to stderr. |
-h, --help |
Print help. |
-V, --version |
Print version. |
On the first run linim:
- If a recognized
LICENSEalready exists (anSPDX-License-Identifier:line, or a body matching a known license), it is used and the interactive license picker is skipped. Otherwise you pick a license. - You provide the copyright holder and year (prompted once).
- linim writes
LICENSEand.linim, then walks the tree and adds or updates the SPDX + copyright header at the top of every comment-capable source file.
On later runs, linim reuses .linim and makes no changes unless something
drifted: headers are compared against the expected form and only rewritten when
they differ, so repeated runs are effectively free.
Key properties:
- Fast. Skips
.gitand everything matched by.gitignore; skips files whose extension has no comment syntax; reads only the first 8 KB of each file on the fast path. Correct files are never rewritten. - Safe. Files with two or more qualifying headers are reported and left alone, never modified. Shebangs, encoding cookies, doctypes, and other preambles are preserved above the injected header.
- Deterministic. Processing is parallel (rayon) but the report and per-file listing are in sorted path order.
A small key = value file at the repo root, committed to git:
# linim project state
spdx = MIT
holder = wendellmeset
year = 2026
headers = true
It stores only the project's licensing decisions. The truth is always derived from the files themselves on each run, so broken or missing headers are caught automatically and updates apply when the license, holder, or year changes.
cargo testto run the unit + integration tests.cargo build --releaseto build the production binary.tools/gen-comment-map/is a dev tool that regenerates the extension to comment-style table fromdata/tokei_languages.json. Not part of the build.