Find and review per-file license evidence in local release trees.
# macOS / Linux
./bin/moon-license-scan --version# Windows PowerShell
.\bin\moon-license-scan.exe --versionmoon update
moon check --target native
moon test --target native
moon build --target native --releasemoon-license-scan scan examples/release-after
moon-license-scan scan examples/release-before --json --output before.json
moon-license-scan scan examples/release-after --json --output after.json
moon-license-scan compare before.json after.json
moon-license-scan notice examples/release-after after.jsonmoon-license-scan preview examples/release-after after.json EVIDENCE_ID| 扫描参数 | 用途 | 默认值 |
|---|---|---|
| --json | 输出 JSON 报告,供比较、预览和生成声明候选 | 文本摘要 |
| --output FILE | 写入新文件,拒绝覆盖 | 标准输出 |
| --exclude PATH | 追加相对根目录的排除前缀,可重复指定 | 排除 .git |
| --max-file-bytes N | 单个文件读取上限 | 2 MiB |
| --max-total-bytes N | 一次扫描累计读取上限 | 64 MiB |
| --max-entries N | 文件系统条目上限 | 12,000 |
| --max-findings N | 证据条数上限 | 4,000 |
// moon.mod
import { "Delthin/moon_license_scan@0.1.1" }// moon.pkg
import { "Delthin/moon_license_scan" @scan }
pkgtype(kind: "executable")fn main {
let report = @scan.Scanner::new().scan("path/to/release") catch {
err => abort("scan failed: \{err}")
}
for file in report.files {
for hit in file.findings {
println("\{file.path}:\{hit.start_line}-\{hit.end_line} \{hit.expression}")
}
}
}moon-license-scan mcp /path/to/release| 工具 | 用途 |
|---|---|
| license_scan | 扫描启动目录,返回第一页,可传 options |
| license_report | 用 next_offset 作为 offset 读取下一页,limit 为 1–50 |
| license_preview | 用 64 个十六进制字符组成的证据 id 回读原文 |
| license_compare | 用 previous 传入上一个版本的完整报告对象 |
| license_notice | 导出当前快照的声明候选与待复核项 |
moon-license-scan serve examples/release-after --port 0| 路径 | 请求体 |
|---|---|
| /api/scan | {} 或 {"options":{"exclude":[".git","vendor/unused"]}};显式 exclude 替换默认列表 |
| /api/preview | {"id":"EVIDENCE_ID"} |
| /api/compare | {"previous":{...}},传入旧版完整报告对象 |
| /api/notice | {} |
pub suberror ScanError {
InvalidInput(String)
StaleEvidence
UnknownEvidence
LimitExceeded(String)
} derive(Debug)pub(all) struct Preview {
path : String
start_line : Int
end_line : Int
text : String
} derive(ToJson)pub(all) struct Report {
schema_version : Int
rules_version : String
directory : Bool
options : ScanOptions
enumeration_complete : Bool
entries : Int
bytes_read : Int
files : Array[FileResult]
diagnostics : Array[String]
} derive(Eq, FromJson, ToJson)pub struct Scanner {
// private fields
}pub struct Session {
// private fields
}Install
Download zipFind and review per-file license evidence in local release trees.