lacspace-license
LICENSE + headers + detection + compatibility.
npx lacspace-license init MITEverything, 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.
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.
Copy, paste, done
Real commands and snippets — from a one-liner to the typed library.
npx lacspace-license init MIT --author "Lacspace" --year 2026Author/year auto-read from package.json when omitted.
npx lacspace-license add "src/**/*.{ts,js}" --id MIT --writeIdempotent — running twice changes nothing.
npx lacspace-license add "src/**/*.ts" --dry-runSee what would change before writing.
npx lacspace-license notices --prod -o THIRD-PARTY-NOTICES.mdGrouped by licence, prod deps only.
npx lacspace-license check --require-headersExits non-zero on any violation.
npx lacspace-license detect LICENSEPrints the SPDX id + confidence; --json for CI.
npx lacspace-license compat --id MIT --deps Apache-2.0,GPL-3.0-onlyNon-zero exit when a dep licence is incompatible.
npx lacspace-license check --require-headers --fixWrites LICENSE, aligns package.json, adds headers.
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
Run lacspace-license today
Free, open-source, no API keys. It's a CLI and a typed library.
npx lacspace-license init MIT