cognis-digital/licenselens

GitHub: cognis-digital/licenselens

面向开发者的依赖许可证扫描与 SBOM 门控 CLI 工具,用于在 CI/CD 中自动化检测许可证合规风险。

Stars: 0 | Forks: 0

LICENSELENS # LICENSELENS ### 依赖许可证 + SBOM 门控,开发者优先的 CLI [![PyPI](https://img.shields.io/pypi/v/cognis-licenselens.svg?color=6b46c1)](https://pypi.org/project/cognis-licenselens/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/c987f697ae083007.svg)](https://github.com/cognis-digital/licenselens/actions) [![License: COCL 1.0](https://img.shields.io/badge/License-COCL%201.0-2b6cb0.svg)](LICENSE) [![Suite](https://img.shields.io/badge/Cognis-Neural%20Suite-6b46c1.svg)](https://github.com/cognis-digital) *开发者工具 — 快速、单一用途、CI 和 agent 友好。*
``` pip install cognis-licenselens licenselens scan . # → prioritized findings in seconds ``` ## 使用说明 — 分步指南 1. **安装**(Python 3.8+,仅使用标准库): pip install licenselens 2. **扫描 requirements 文件**,根据内置的许可证策略进行比对并对构建进行门控: licenselens scan requirements.txt 门控通过时返回状态码 `0`,遇到禁止或未知的许可证时返回 `1`,遇到 IO 错误返回 `2`。 3. **以 JSON 格式读取输出**,用于仪表盘或策略报告: licenselens --format json scan requirements.txt | jq '.counts, .findings[]' 4. **为相同的依赖集生成 CycloneDX 风格的 SBOM**: licenselens --format json sbom requirements.txt > sbom.json 5. **门控 CI** — 如果发生许可证违规则中断流水线,并将 SBOM 作为 artifact 附加: licenselens scan requirements.txt && licenselens --format json sbom requirements.txt > sbom.json ## 目录 - [为什么选择 licenselens?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [功能对比](#how-it-compares) · [集成](#integrations) · [随处安装](#install-anywhere) · [相关项目](#related) · [贡献指南](#contributing) ## 为什么选择 licenselens? CI 中的许可证风险 `licenselens` 具有单一用途、可脚本化且支持自托管:将其指向目标,即可使用你的工作流已具备的格式(表格 · JSON · SARIF)获取优先级排序的结果,以此对 CI 进行门控,并允许 agent 通过 MCP 驱动它。
↑ 返回顶部
## 功能 - ✅ 规范化许可证 - ✅ 分类 - ✅ 解析依赖文件 (Requirements) - ✅ 扫描项目 - ✅ 构建 SBOM - ✅ 运行于 Linux/macOS/Windows · Docker · devcontainer - ✅ 支持 Python、JavaScript、Go 和 Rust 多语言端口 (`ports/`)
↑ 返回顶部
## 快速开始 ``` pip install cognis-licenselens licenselens --version licenselens scan . # scan current project licenselens scan . --format json # machine-readable licenselens scan . --fail-on high # CI gate (non-zero exit) ```
↑ 返回顶部
## 示例 ``` $ licenselens scan . [HIGH ] LIC-001 example finding (./src/app.py) [MEDIUM ] LIC-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 返回顶部
## 架构 ``` flowchart LR IN[target / manifest] --> P[licenselens
checks + rules] P --> OUT[findings (JSON / SARIF)] ```
↑ 返回顶部
## 从任意 AI 技术栈中使用 `licenselens` 能够与所有流行的 AI 使用方式实现互操作: - **MCP server** — `licenselens mcp`(Claude Desktop、Cursor、Cognis.Studio、[uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** — 将 `licenselens scan . --format json` 的输出通过管道传递给任何 agent 或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 只需一行代码即可将 CLI/JSON 封装为工具 - **CI / 脚本** — 为非 AI 流水线提供退出码和 SARIF 支持
↑ 返回顶部
## 功能对比 | | **Cognis licenselens** | FOSSA | |---|:---:|:---:| | 支持自托管,无需账号 | ✅ | 视情况而定 | | 单一命令,零配置 | ✅ | ⚠️ | | 用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | 原生 MCP 支持(AI agent) | ✅ | ❌ | | 多语言端口 (JS/Go/Rust) | ✅ | ❌ | | 开源许可证 | ✅ COCL | 视情况而定 | *秉承 **FOSSA** 的精神,以 Cognis 的方式重新构建。遗漏了致谢?欢迎提交 PR。*
↑ 返回顶部
## 集成 接入你的技术栈:用于代码扫描的 **SARIF**,用于一切的 **JSON**,用于 AI agent 的 **MCP server** (`licenselens mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。详见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 返回顶部
## 安装 — 涵盖所有方式、所有平台 ``` pip install "git+https://github.com/cognis-digital/licenselens.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/licenselens.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/licenselens.git" # uv pip install cognis-licenselens # PyPI (when published) docker run --rm ghcr.io/cognis-digital/licenselens:latest --help # Docker brew install cognis-digital/tap/licenselens # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/licenselens/main/install.sh | sh ``` | Linux | macOS | Windows | Docker | 云平台 | |---|---|---|---|---| | `scripts/setup-linux.sh` | `scripts/setup-macos.sh` | `scripts/setup-windows.ps1` | `docker run ghcr.io/cognis-digital/licenselens` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 返回顶部
## 相关 Cognis 工具 - [`mcpforge`](https://github.com/cognis-digital/mcpforge) — 几分钟内完成 MCP server 的构建、测试和发布 - [`promptlint`](https://github.com/cognis-digital/promptlint) — 将 prompt 作为代码进行 lint、版本控制和测试,并带有 CI 门控 - [`envdoctor`](https://github.com/cognis-digital/envdoctor) — .env 验证器、密钥存在性和配置漂移检查器 - [`apidiff`](https://github.com/cognis-digital/apidiff) — 针对不同 commit 间的 OpenAPI / GraphQL 破坏性变更检测器 - [`codeglance`](https://github.com/cognis-digital/codeglance) — 代码库引导指南 — 为人类和 agent 提供架构概览与热点区域 - [`flakefinder`](https://github.com/cognis-digital/flakefinder) — 基于 CI 历史记录的不稳定测试检测器,并提供隔离建议 **探索工具套件 →** [🗂️ 所有 170+ 工具](https://github.com/cognis-digital/cognis-neural-suite) · [⭐ awesome-cognis](https://github.com/cognis-digital/awesome-cognis) · [🔗 cognis-sources](https://github.com/cognis-digital/cognis-sources) · [🤖 uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet) · [🧠 engram](https://github.com/cognis-digital/engram)
↑ 返回顶部
## 互操作性 `{}` 与包含 300+ 工具的 Cognis 套件组合使用 — JSON 输入/输出以及共享的 兼容 OpenAI 的 `/v1` 骨干网络。有关套件映射、组合模式和参考技术栈, 请参阅 **[INTEROP.md](INTEROP.md)**。 ## 许可证 在 **Cognis Open Collaboration License (COCL) v1.0** 下源代码可见 — 个人、内部评估、研究和教育用途免费;**商业/生产用途需要获取许可证** (licensing@cognis.digital)。请参阅 [LICENSE](LICENSE)。
Cognis Digital · Cognis Neural Suite 中 170+ 工具之一 · 让明天更美好
标签:LNA, Python, SBOM, SOC Prime, 开发工具, 开源合规, 无后门, 硬件无关, 许可证检查, 请求拦截, 逆向工具