{"id":22606398,"url":"https://github.com/ekkolon/licensa","last_synced_at":"2025-04-11T05:15:18.773Z","repository":{"id":220993390,"uuid":"745682427","full_name":"ekkolon/licensa","owner":"ekkolon","description":"Seamless source code license management from your command line","archived":false,"fork":false,"pushed_at":"2025-02-03T18:54:50.000Z","size":572,"stargazers_count":3,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T14:48:43.529Z","etag":null,"topics":["cli","command-line-tool","license-management","licensing","spdx-licenses"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/licensa","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ekkolon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-19T21:34:10.000Z","updated_at":"2024-12-26T17:06:24.000Z","dependencies_parsed_at":"2024-03-31T16:30:49.050Z","dependency_job_id":null,"html_url":"https://github.com/ekkolon/licensa","commit_stats":null,"previous_names":["ekkolon/licensa"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekkolon%2Flicensa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekkolon%2Flicensa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekkolon%2Flicensa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekkolon%2Flicensa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekkolon","download_url":"https://codeload.github.com/ekkolon/licensa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247792888,"owners_count":20996891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line-tool","license-management","licensing","spdx-licenses"],"created_at":"2024-12-08T14:13:27.849Z","updated_at":"2025-04-11T05:15:18.749Z","avatar_url":"https://github.com/ekkolon.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Licensa\n\n[![codecov](https://codecov.io/gh/ekkolon/licensa/graph/badge.svg?token=APBWVQY4HF)](https://codecov.io/gh/ekkolon/licensa)\n![Crates.io Version](https://img.shields.io/crates/v/licensa)\n![docs.rs](https://img.shields.io/docsrs/licensa)\n![Crates.io License (version)](https://img.shields.io/crates/l/licensa/0.1.0)\n\nLicensa is a powerful CLI tool designed for seamless source code license management. Developers can effortlessly **verify**, **apply**, **modify**, and **enforce** SPDX license headers across their source code.\n\nAs of today, Licensa boasts compatibility with over **65 file types**, making it a versatile and comprehensive solution for license management in diverse coding environments.\n\nYou may be looking for:\n\n- [Overview](#overview)\n- [Installation](#installation)\n- [Usage](#usage)\n- [CLI Reference](#cli-reference)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Overview\n\nExplore the [complete CLI reference](#cli-reference) for a comprehensive list of [options](#options).\n\n**`init`** Generate project-wide Licensa configuration.\n\n```bash\nlicensa init [OPTIONS]\n```\n\n**`apply`** Add SPDX copyright license headers to source code files.\n\n```bash\nlicensa apply [OPTIONS]\n```\n\n**`verify`** Verify presence of license headers in source code files.\n\n```bash\nlicensa verify\n```\n\n## Installation\n\n### Cargo\n\n```shell\ncargo install licensa\n```\n\n### Linux\n\nLicensa currently supports the following architectures:\n\n- **x86_64** (64-bit Intel/AMD processors)\n- **aarch64** (64-bit ARM processors)\n\nRun the following command and follow the on-screen instructions:\n\n```bash\nbash -c \"$(curl -fsSL https://raw.githubusercontent.com/ekkolon/licensa/main/scripts/install.sh)\"\n```\n\nThis script will:\n\n- automatically detect your machine's architecture\n- download and unpack the necessary .tar\n- copy the `licensa` binary to `usr/local/bin`\n\nFor more details, you can review the [installation script](/scripts/install.sh) directly.\n\n### Windows (PowerShell)\n\nBefore running the installation script, ensure that your PowerShell execution policy allows (remote) script execution. You can set the execution policy using the following command:\n\n```powershell\nSet-ExecutionPolicy RemoteSigned -Scope CurrentUser\n```\n\nExecuting the following script will walk you through the installation process (you may need to run this command from an elevated shell):\n\n```powershell\nInvoke-Expression -Command (Invoke-WebRequest -Uri \"https://raw.githubusercontent.com/ekkolon/licensa/main/scripts/install.ps1\" -UseBasicParsing).Content\n```\n\n## Usage\n\n\u003e This is an example walkthrough\n\nSuppose you have a TypeScript project \"Lord Of The Rings Map\" (lotr-map) with the following initial structure:\n\n```bash\n.\n└── lotr-map/\n    ├── node_modules/\n    ├── src/\n    │   ├── map/\n    │   │   └── Terrain.ts    # has license header\n    │   ├── Rivendell.ts      # no license header\n    │   ├── Isengard.ts       # no license header\n    │   ├── Mithrandir.ts     # has license header\n    │   ├── Gondor.ts         # has license header\n    │   └── MinasTirith.ts    # has license header\n    ├── .gitignore  \n    ├── package.json\n    └── tsconfig.json\n```\n\n### Generate project-wide Licensa configurations\n\n\u003e When a `.licensarc` config file is present, required arguments in subsequent commands become optional if they are already defined in the config file.\n\nLicensa includes a pre-built [.licensaignore](/.licensaignore) file, akin to a *.gitignore*, allowing you to specify patterns for including/excluding files from the licensing process.\n\nTo generate project-wide configurations, execute the following command:\n\n```bash\nlicensa init --type Apache-2.0 --owner \"Eru Ilúvata\" --year 2001\n```\n\nUpon successful execution, the command will expand your project structure to include the *.licensarc* and [.licensaignore](/.licensaignore):\n\n```bash\n.\n└── lotr-map/\n    ├── node_modules/\n    ├── src/\n    │   ├── map/\n    │   │   └── Terrain.ts    # has license header\n    │   ├── Rivendell.ts      # no license header\n    │   ├── Isengard.ts       # no license header\n    │   ├── Mithrandir.ts     # has license header\n    │   ├── Gondor.ts         # has license header\n    │   └── MinasTirith.ts    # has license header\n    ├── .gitignore  \n    ├── .licensaignore        # ADDED\n    ├── .licensarc            # ADDED\n    ├── package.json\n    └── tsconfig.json\n```\n\nThe generated `.licensarc` config file would contain the following settings:\n\n```json\n{\n  \"type\": \"Apache-2.0\",\n  \"owner\": \"Eru Ilúvata\",\n  \"year\": 2001\n}\n```\n\n### Add license headers to your source files\n\nExpanding on the project layout described earlier, it's noted that three source files already have SPDX license headers applied to them. Consequently, these files are excluded from the licensing process.\n\n#### With defaults from `.licensarc` config file\n\n```bash\nlicensa apply\n```\n\n##### *src/Rivendell.ts*\n\n```ts\n/**\n * Copyright 2001 Eru Ilúvata\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport Terrain from './map/Terrain.ts';\n\nexport class Rivendell extends Terrain {}\n```\n\n##### *src/Isengard.ts*\n\n```ts\n/**\n * Copyright 2001 Eru Ilúvata\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport Terrain from './map/Terrain.ts';\n\nexport class Isengard extends Terrain {}\n```\n\n#### Override defaults with supplied options\n\n```bash\nlicensa apply --type AGPL-3.0-only --owner Sauron --year \"2002-present\"\n```\n\n##### *src/Rivendell.ts*\n\n```ts\n/**\n * Copyright 2002-present Sauron\n * SPDX-License-Identifier: AGPL-3.0-only\n */\n\nimport Terrain from './map/Terrain.ts';\n\nexport class Rivendell extends Terrain {}\n```\n\n##### *src/Isengard.ts*\n\n```ts\n/**\n * Copyright 2002-present Sauron\n * SPDX-License-Identifier: AGPL-3.0-only\n */\n\nimport Terrain from './map/Terrain.ts';\n\nexport class Isengard extends Terrain {}\n```\n\n## CLI Reference\n\n### Commands\n\n#### `init`\n\nGenerate project-wide Licensa configuration.\n\n```bash\nlicensa init [OPTIONS]\n```\n\n#### `apply`\n\nAdd SPDX copyright license headers to source code files.\n\n```bash\nlicensa apply [OPTIONS]\n```\n\n#### `verify`\n\nVerify presence of license headers in source code files.\n\n```bash\nlicensa verify\n```\n\n### Options\n\n**-t, --type** `required` SPDX License identifier (case-insensitive)\n\nOptional, if present in .licensarc config file\n\n*default*: N/A\n\n**-o, --owner** `required` The copyright owner\n\nOptional, if present in .licensarc config file\n\n*default*: N/A\n\n**--year** The copyright year or a range of years\n\n*default*: null\n\n**--exclude** A list of glob patterns to exclude from the licensing process\n\n#### Globals\n\n**--verbose** Detailed command output\n\n**-h, --help** Show help message\n\n**-v, --version** Show program's version number\n\n## License\n\nLicensed under either of\n\n- [MIT license](https://spdx.org/licenses/MIT.html) (see [LICENSE-MIT](/LICENSE-MIT)) or\n- [Apache License, Version 2.0](https://spdx.org/licenses/Apache-2.0.html) (see [LICENSE-APACHE](/LICENSE-APACHE))\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekkolon%2Flicensa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekkolon%2Flicensa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekkolon%2Flicensa/lists"}