lacspace-license

LICENSE + headers + detection + compatibility.

● Live · v0.2.0npm ↗Source ↗
terminal
npx lacspace-license init MIT
What it does

Everything, in one command

Most projects get their licensing right once and then let it rot — the year in the header ages, a new file ships with no notice, package.json says MIT while the LICENSE file says something else. lacspace-license makes licence hygiene a one-command, CI-enforceable step. It embeds the full canonical texts of 12 common licences (plus the Lacspace Free Licence), fills your name and year, understands the comment syntax of 60+ file types, and never corrupts a file — headers are idempotent, shebang-safe and preserve your line endings. It runs entirely on local files with no network and no telemetry.

Features

What's inside

LICENSE generator

Filled from any SPDX id, author/year read from package.json.

Per-file headers

Correct //, #, --, /* */, <!-- --> syntax per language.

Idempotent & safe

Re-runs are no-ops; shebang, EOL and final newline preserved.

THIRD-PARTY-NOTICES

Grouped-by-licence md/txt from node_modules, --prod aware.

CI gate

check fails when LICENSE is missing, mismatched, or a header is absent.

Fuzzy detection

Identifies a LICENSE text tolerant of CRLF/whitespace.

Zero deps, offline

Full licence texts embedded; nothing leaves your machine.

Licence detection

Identify the SPDX id of any LICENSE file with a confidence score, tolerant of whitespace/CRLF and preamble.

Compatibility checker

Flag dependency licences that clash with your project (e.g. GPL in an MIT project) via a built-in matrix.

Auto-repair (--fix)

Write a missing LICENSE, align package.json's license field, and insert missing headers in one command.

Copyleft-aware verdicts

Weak copyleft (LGPL/MPL) is marked "review", strong copyleft is failed, permissive always passes.

How to use

Copy, paste, done

Real commands and snippets — from a one-liner to the typed library.

Create a LICENSE
terminal
npx lacspace-license init MIT --author "Lacspace" --year 2026

Author/year auto-read from package.json when omitted.

Stamp headers
terminal
npx lacspace-license add "src/**/*.{ts,js}" --id MIT --write

Idempotent — running twice changes nothing.

Preview a diff
terminal
npx lacspace-license add "src/**/*.ts" --dry-run

See what would change before writing.

Third-party notices
terminal
npx lacspace-license notices --prod -o THIRD-PARTY-NOTICES.md

Grouped by licence, prod deps only.

CI gate
terminal
npx lacspace-license check --require-headers

Exits non-zero on any violation.

Detect a licence
terminal
npx lacspace-license detect LICENSE

Prints the SPDX id + confidence; --json for CI.

Check dependency compatibility
terminal
npx lacspace-license compat --id MIT --deps Apache-2.0,GPL-3.0-only

Non-zero exit when a dep licence is incompatible.

Auto-fix a failing gate
terminal
npx lacspace-license check --require-headers --fix

Writes LICENSE, aligns package.json, adds headers.

Good for

What people build with it

✓ Ship a correct LICENSE in seconds

✓ Enforce licence headers across a monorepo in CI

✓ Keep copyright years current

✓ Produce attribution/notices for a release

Start now

Run lacspace-license today

Free, open-source, no API keys. It's a CLI and a typed library.

terminal
npx lacspace-license init MIT