license-wizard
v1.1.0
Published
Interactive and scriptable CLI that generates a correct LICENSE file from the full SPDX catalog, syncs the chosen license into your package.json/composer.json, stamps source-file headers, and verifies everything stays in sync in CI.
Maintainers
Readme
Why License Wizard?
Most projects declare a license in package.json or composer.json, yet the actual LICENSE file at the repository root is a separate, manual step — track down the canonical text, fill in copyright placeholders, and keep the declared license and the file in sync. It's easy to forget, leaving repositories with a declared license but no real LICENSE file, or text that subtly differs from the official source.
License Wizard closes that gap. It walks you through choosing a license, pulls the canonical SPDX text, fills in your copyright details, writes a proper LICENSE file, and records the choice back into your manifests so everything stays consistent. The same predictable flow that guides a human also drives cleanly from scripts, CI, and AI agents.
Features
- Full SPDX catalog — search and pick from the complete, up-to-date SPDX License List with type-ahead autocomplete.
- Canonical text, every time — license text comes straight from the official SPDX data, so there are no hand-copied variations.
- Copyright customization — for licenses with fillable fields (copyright holder, year, and similar), use the official text as-is or fill in each field.
- Manifest-aware — reads the license already declared in your
package.jsonorcomposer.jsonto pre-select a default, and writes your final choice back to every manifest it finds. - Source-file headers — optionally stamps a per-file license header across your
.js/.ts/.phpsources, and keeps them in sync. - Stays honest —
--verifychecks that yourLICENSE, manifests, and headers still match the license you chose, and can fail the build in CI when they drift. - Zero config to start — run it with
npx, answer a few prompts, done.
Requirements
- Node.js
>= 22.13.0 - Network access
Quick Start
Run it directly — no install required. Use whichever package manager you have:
npx license-wizard # npm
pnpm dlx license-wizard # pnpm
yarn dlx license-wizard # yarn
bunx license-wizard # bunOr install it globally:
npm install -g license-wizard
# then, in any project directory:
license-wizardUsage
Run the command from the root of the project you want to license, and you'll be guided through a short interactive flow:
- Choose a license — start typing to search the SPDX catalog (e.g.
MIT,Apache-2.0,GPL-3.0-or-later) and select one. If your project already declares a license, it's offered as the default. - Standard or customized — if the license has fillable copyright fields, keep the official text verbatim or fill in each field (such as the copyright holder and year).
- Save your settings — choose whether to remember your selection for next time.
When you're done, License Wizard writes the LICENSE file and records the selected SPDX identifier in every manifest it finds (package.json, composer.json).
Prefer one command? Generate a license non-interactively — handy for scripts, CI, and AI agents:
npx license-wizard --license MITDocumentation
Full documentation lives on the docs site:
→ License Wizard documentation
It covers everything beyond the quick start:
- Interactive wizard and one-shot generation (
--license,--set,--get-tokens) - Source-file headers —
shortvsfull,blockvsdocblockcomments (for PHPDoc/WPCS), and removing them - Verify & CI —
--verify,--strict, and the drop-in CI step - Apply saved config — replaying a saved license with
--apply-config - Configuration files —
.licensewizardrc.jsonand manifest fields - Scripting & agents — exit codes and non-interactive contracts
- Flags reference — the complete flag list
Reading this as an AI agent or from a script? The same documentation is published as plain Markdown: documentation.md.
Run npx license-wizard --help to print the flag list from the CLI.
License
Apache-2.0 © Erdem Bircan
