license-trace 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. license_trace-0.1.3/.cargo/config.toml +5 -0
  2. license_trace-0.1.3/.github/workflows/cd.yml +270 -0
  3. license_trace-0.1.3/.github/workflows/ci.yml +42 -0
  4. license_trace-0.1.3/.gitignore +6 -0
  5. license_trace-0.1.3/CHANGELOG.md +35 -0
  6. license_trace-0.1.3/CODE_OF_CONDUCT.md +55 -0
  7. license_trace-0.1.3/CONTRIBUTING.md +43 -0
  8. license_trace-0.1.3/Cargo.lock +1845 -0
  9. license_trace-0.1.3/Cargo.toml +38 -0
  10. license_trace-0.1.3/LICENSE +21 -0
  11. license_trace-0.1.3/PKG-INFO +345 -0
  12. license_trace-0.1.3/README.ja.md +321 -0
  13. license_trace-0.1.3/README.md +322 -0
  14. license_trace-0.1.3/SECURITY.md +29 -0
  15. license_trace-0.1.3/THIRD_PARTY_LICENSES.md +29057 -0
  16. license_trace-0.1.3/pyproject.toml +31 -0
  17. license_trace-0.1.3/src/app.rs +311 -0
  18. license_trace-0.1.3/src/bin/lt.rs +4 -0
  19. license_trace-0.1.3/src/cli.rs +128 -0
  20. license_trace-0.1.3/src/lib.rs +6 -0
  21. license_trace-0.1.3/src/main.rs +4 -0
  22. license_trace-0.1.3/src/model/graph.rs +189 -0
  23. license_trace-0.1.3/src/model/license.rs +677 -0
  24. license_trace-0.1.3/src/model/mod.rs +7 -0
  25. license_trace-0.1.3/src/model/package.rs +90 -0
  26. license_trace-0.1.3/src/policy/compatibility.rs +164 -0
  27. license_trace-0.1.3/src/policy/mod.rs +5 -0
  28. license_trace-0.1.3/src/policy/obligations.rs +133 -0
  29. license_trace-0.1.3/src/policy/rules.rs +35 -0
  30. license_trace-0.1.3/src/reporter/audit.rs +266 -0
  31. license_trace-0.1.3/src/reporter/cyclonedx.rs +149 -0
  32. license_trace-0.1.3/src/reporter/json.rs +23 -0
  33. license_trace-0.1.3/src/reporter/mod.rs +15 -0
  34. license_trace-0.1.3/src/reporter/notice.rs +82 -0
  35. license_trace-0.1.3/src/reporter/sarif.rs +149 -0
  36. license_trace-0.1.3/src/reporter/table.rs +74 -0
  37. license_trace-0.1.3/src/reporter/tree.rs +69 -0
  38. license_trace-0.1.3/src/resolver/cargo.rs +562 -0
  39. license_trace-0.1.3/src/resolver/gomod.rs +243 -0
  40. license_trace-0.1.3/src/resolver/mod.rs +35 -0
  41. license_trace-0.1.3/src/resolver/npm_local.rs +325 -0
  42. license_trace-0.1.3/src/resolver/npm_online.rs +305 -0
  43. license_trace-0.1.3/src/resolver/python.rs +523 -0
  44. license_trace-0.1.3/tests/fixtures/sample_project/package-lock.json +40 -0
  45. license_trace-0.1.3/tests/fixtures/sample_project/package.json +13 -0
  46. license_trace-0.1.3/tests/integration_test.rs +56 -0
@@ -0,0 +1,5 @@
1
+ [alias]
2
+ a = "run --bin lt -- a"
3
+ t = "run --bin lt -- t"
4
+ w = "run --bin lt -- w"
5
+ ex = "run --bin lt -- e"
@@ -0,0 +1,270 @@
1
+ name: CD (Release & Publish)
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ paths-ignore:
7
+ - "**.md"
8
+ - "docs/**"
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+ packages: write
14
+ id-token: write
15
+
16
+ jobs:
17
+ check-version:
18
+ name: Check Version & Determine Release
19
+ runs-on: ubuntu-latest
20
+ outputs:
21
+ should_publish: ${{ steps.check.outputs.should_publish }}
22
+ version: ${{ steps.check.outputs.version }}
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+
28
+ - name: Extract version from Cargo.toml
29
+ id: check
30
+ run: |
31
+ VERSION=$(grep -m 1 '^version =' Cargo.toml | tr -s ' ' | cut -d '"' -f 2)
32
+ echo "Cargo.toml version: $VERSION"
33
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
34
+
35
+ # Check if git tag already exists
36
+ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
37
+ echo "Tag v$VERSION already exists. Skipping release."
38
+ echo "should_publish=false" >> "$GITHUB_OUTPUT"
39
+ else
40
+ echo "Tag v$VERSION does not exist yet. Will proceed with release."
41
+ echo "should_publish=true" >> "$GITHUB_OUTPUT"
42
+ fi
43
+
44
+ # ==========================================
45
+ # 1. Publish to crates.io
46
+ # ==========================================
47
+ publish-crates:
48
+ name: Publish to crates.io
49
+ needs: check-version
50
+ if: needs.check-version.outputs.should_publish == 'true'
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@v4
54
+ - name: Install Rust toolchain
55
+ uses: dtolnay/rust-toolchain@stable
56
+ - name: Publish to crates.io
57
+ run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
58
+ env:
59
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
60
+ continue-on-error: true
61
+
62
+ # ==========================================
63
+ # 2. Build multi-platform binaries
64
+ # ==========================================
65
+ build-binaries:
66
+ name: Build Binary (${{ matrix.target }})
67
+ needs: check-version
68
+ if: needs.check-version.outputs.should_publish == 'true'
69
+ runs-on: ${{ matrix.os }}
70
+ strategy:
71
+ fail-fast: false
72
+ matrix:
73
+ include:
74
+ - os: ubuntu-latest
75
+ target: x86_64-unknown-linux-gnu
76
+ binary_name: license-trace
77
+ output_name: license-trace-x86_64-unknown-linux-gnu
78
+ use_cross: false
79
+ - os: ubuntu-latest
80
+ target: aarch64-unknown-linux-gnu
81
+ binary_name: license-trace
82
+ output_name: license-trace-aarch64-unknown-linux-gnu
83
+ use_cross: true
84
+ - os: macos-latest
85
+ target: x86_64-apple-darwin
86
+ binary_name: license-trace
87
+ output_name: license-trace-x86_64-apple-darwin
88
+ use_cross: false
89
+ - os: macos-latest
90
+ target: aarch64-apple-darwin
91
+ binary_name: license-trace
92
+ output_name: license-trace-aarch64-apple-darwin
93
+ use_cross: false
94
+ - os: windows-latest
95
+ target: x86_64-pc-windows-msvc
96
+ binary_name: license-trace.exe
97
+ output_name: license-trace-x86_64-pc-windows-msvc.exe
98
+ use_cross: false
99
+ steps:
100
+ - uses: actions/checkout@v4
101
+
102
+ - name: Install Rust toolchain
103
+ uses: dtolnay/rust-toolchain@stable
104
+ with:
105
+ targets: ${{ matrix.target }}
106
+
107
+ - name: Install cross (if required)
108
+ if: matrix.use_cross
109
+ run: cargo install cross --git https://github.com/cross-rs/cross
110
+
111
+ - name: Build Binary
112
+ run: |
113
+ if [ "${{ matrix.use_cross }}" = "true" ]; then
114
+ cross build --release --target ${{ matrix.target }}
115
+ else
116
+ cargo build --release --target ${{ matrix.target }}
117
+ fi
118
+ shell: bash
119
+
120
+ - name: Copy & Rename Artifact
121
+ run: |
122
+ mkdir -p dist
123
+ cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} dist/${{ matrix.output_name }}
124
+ shell: bash
125
+
126
+ - name: Upload Binary Artifact
127
+ uses: actions/upload-artifact@v4
128
+ with:
129
+ name: binary-${{ matrix.target }}
130
+ path: dist/${{ matrix.output_name }}
131
+ retention-days: 2
132
+
133
+ # ==========================================
134
+ # 3. Publish to PyPI (maturin)
135
+ # ==========================================
136
+ publish-pypi:
137
+ name: Publish to PyPI
138
+ needs: check-version
139
+ if: needs.check-version.outputs.should_publish == 'true'
140
+ runs-on: ${{ matrix.os }}
141
+ strategy:
142
+ fail-fast: false
143
+ matrix:
144
+ include:
145
+ - os: ubuntu-latest
146
+ target: x86_64-unknown-linux-gnu
147
+ manylinux: auto
148
+ - os: ubuntu-latest
149
+ target: aarch64-unknown-linux-gnu
150
+ manylinux: auto
151
+ - os: macos-latest
152
+ target: x86_64-apple-darwin
153
+ - os: macos-latest
154
+ target: aarch64-apple-darwin
155
+ - os: windows-latest
156
+ target: x86_64-pc-windows-msvc
157
+ steps:
158
+ - uses: actions/checkout@v4
159
+ - uses: actions/setup-python@v5
160
+ with:
161
+ python-version: "3.11"
162
+
163
+ - name: Set up QEMU
164
+ if: matrix.target == 'aarch64-unknown-linux-gnu'
165
+ uses: docker/setup-qemu-action@v3
166
+
167
+ - name: Build wheels
168
+ uses: PyO3/maturin-action@v1
169
+ with:
170
+ target: ${{ matrix.target }}
171
+ manylinux: ${{ matrix.manylinux || 'off' }}
172
+ args: --release --out dist
173
+ docker-options: -e CFLAGS="-D__ARM_ARCH=8"
174
+ continue-on-error: true
175
+
176
+ - name: Upload PyPI wheels
177
+ uses: actions/upload-artifact@v4
178
+ with:
179
+ name: pypi-wheels-${{ matrix.target }}
180
+ path: dist/*.whl
181
+ continue-on-error: true
182
+
183
+ publish-pypi-release:
184
+ name: Upload all wheels to PyPI
185
+ needs: [check-version, publish-pypi]
186
+ if: always() && !cancelled() && needs.check-version.outputs.should_publish == 'true'
187
+ runs-on: ubuntu-latest
188
+ steps:
189
+ - uses: actions/checkout@v4
190
+ - uses: actions/setup-python@v5
191
+ with:
192
+ python-version: "3.11"
193
+
194
+ - name: Download wheels
195
+ uses: actions/download-artifact@v4
196
+ with:
197
+ pattern: pypi-wheels-*
198
+ merge-multiple: true
199
+ path: dist
200
+ continue-on-error: true
201
+
202
+ - name: Build sdist
203
+ uses: PyO3/maturin-action@v1
204
+ with:
205
+ command: sdist
206
+ args: --out dist
207
+
208
+ - name: Publish to PyPI
209
+ uses: pypa/gh-action-pypi-publish@release/v1
210
+ with:
211
+ password: ${{ secrets.PYPI_API_TOKEN }}
212
+ packages-dir: dist
213
+ continue-on-error: true
214
+
215
+ # ==========================================
216
+ # 4. Create GitHub Release & Upload Archives
217
+ # ==========================================
218
+ publish-github-release:
219
+ name: Create GitHub Release
220
+ needs: [check-version, build-binaries]
221
+ if: needs.check-version.outputs.should_publish == 'true'
222
+ runs-on: ubuntu-latest
223
+ steps:
224
+ - uses: actions/checkout@v4
225
+
226
+ - name: Download all binaries
227
+ uses: actions/download-artifact@v4
228
+ with:
229
+ pattern: binary-*
230
+ merge-multiple: true
231
+ path: dist-binaries
232
+
233
+ - name: Package release archives & compute checksums
234
+ run: |
235
+ mkdir -p release-assets
236
+ VERSION="${{ needs.check-version.outputs.version }}"
237
+
238
+ # Packaging Unix binaries as tar.gz
239
+ for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu x86_64-apple-darwin aarch64-apple-darwin; do
240
+ bin="dist-binaries/license-trace-$target"
241
+ if [ -f "$bin" ]; then
242
+ chmod +x "$bin"
243
+ cp "$bin" license-trace
244
+ tar -czf "release-assets/license-trace-v${VERSION}-${target}.tar.gz" license-trace
245
+ rm license-trace
246
+ fi
247
+ done
248
+
249
+ # Packaging Windows binary as zip
250
+ if [ -f "dist-binaries/license-trace-x86_64-pc-windows-msvc.exe" ]; then
251
+ cp "dist-binaries/license-trace-x86_64-pc-windows-msvc.exe" license-trace.exe
252
+ zip "release-assets/license-trace-v${VERSION}-x86_64-pc-windows-msvc.zip" license-trace.exe
253
+ rm license-trace.exe
254
+ fi
255
+
256
+ # Generate SHA-256 checksums
257
+ cd release-assets
258
+ sha256sum * > SHA256SUMS.txt
259
+ cd ..
260
+
261
+ - name: Create Git Tag & GitHub Release
262
+ uses: softprops/action-gh-release@v2
263
+ with:
264
+ tag_name: "v${{ needs.check-version.outputs.version }}"
265
+ name: "Release v${{ needs.check-version.outputs.version }}"
266
+ generate_release_notes: true
267
+ files: |
268
+ release-assets/*
269
+ env:
270
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,42 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ paths-ignore:
7
+ - "**.md"
8
+ - "docs/**"
9
+ pull_request:
10
+ branches: [main, master]
11
+
12
+ concurrency:
13
+ group: ci-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ test:
18
+ name: Test (${{ matrix.os }})
19
+ runs-on: ${{ matrix.os }}
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ os: [ubuntu-latest, macos-latest, windows-latest]
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Install Rust toolchain
28
+ uses: dtolnay/rust-toolchain@stable
29
+ with:
30
+ components: rustfmt, clippy
31
+
32
+ - name: Rust Cache
33
+ uses: Swatinem/rust-cache@v2
34
+
35
+ - name: Check Formatting
36
+ run: cargo fmt --all --check
37
+
38
+ - name: Clippy Linter
39
+ run: cargo clippy --all-targets -- -D warnings
40
+
41
+ - name: Run Tests
42
+ run: cargo test --all-targets --all-features
@@ -0,0 +1,6 @@
1
+ /target
2
+ /charts
3
+ /dist
4
+ /dist-binaries
5
+ /release-assets
6
+ *.whl
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.3] - 2026-08-23
9
+
10
+ ### Added
11
+ - Short binary alias `lt` alongside `license-trace` for rapid command-line execution.
12
+ - 1-letter subcommand aliases: `a` (audit), `t` (trace), `w` (why), `e` (export).
13
+ - Short CLI flags: `-P` (`--prod-only`), `-i` (`--fail-on-incompatible`), `-u` (`--fail-on-unknown`), `-d` (`--max-depth`).
14
+ - Local developer cargo aliases (`cargo a`, `cargo t`, `cargo w`, `cargo ex`) in `.cargo/config.toml`.
15
+ - CycloneDX SBOM and SARIF reporter integration (`--format cyclonedx`, `--format sarif`).
16
+
17
+ ## [0.1.1] - 2026-08-20
18
+
19
+ ### Added
20
+ - Online PyPI JSON API integration for real-time license metadata resolution on remote/uninstalled Python projects.
21
+ - Full support for `uv.lock` dependency lockfile parsing and multi-line array `pyproject.toml` parsing.
22
+ - Automated Continuous Delivery (CD) workflow for crates.io, PyPI, and GitHub Releases.
23
+
24
+ ## [0.1.0] - 2026-08-19
25
+
26
+ ### Added
27
+ - Multi-ecosystem dependency license tracking and compliance analysis (Cargo, npm, PyPI, Go modules).
28
+ - Unified CLI interface supporting local directories, remote registry packages, and Git URLs (`trace`).
29
+ - Strict SPDX AST evaluation engine (`OR` chooses best permissible branch; `AND` combines strict requirements).
30
+ - Outbound license compatibility policy engine (evaluating against MIT, Apache-2.0, dual-licenses).
31
+ - Aggregated lower-bound legal obligations calculator (commercial use, source disclosure level, copyright notice attribution).
32
+ - Deep dependency path tracing (`why <package>`) via shortest-path BFS and all-simple-paths graph traversal.
33
+ - Multi-format reporting: Audit terminal view, Comfy-Table view, Tree structure, JSON, and Markdown.
34
+ - Third-party notices and licenses generator (`export --output THIRD_PARTY_LICENSES.md`).
35
+ - Multi-OS GitHub Actions CI/CD workflows and full test coverage suite.
@@ -0,0 +1,55 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all community spaces, and also applies when
49
+ an individual is officially representing the community in public spaces.
50
+
51
+ ## Enforcement
52
+
53
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
54
+ reported to the project team at `rikutoyamada01@gmail.com`. All
55
+ complaints will be reviewed and investigated promptly and fairly.
@@ -0,0 +1,43 @@
1
+ # Contributing to license-trace
2
+
3
+ Thank you for your interest in contributing to `license-trace`! We welcome contributions from the community.
4
+
5
+ ## Development Setup
6
+
7
+ ### Prerequisites
8
+ - [Rust](https://www.rust-lang.org/tools/install) 1.75 or higher (with `cargo`, `rustfmt`, and `clippy`)
9
+ - Git
10
+
11
+ ### Getting Started
12
+
13
+ ```bash
14
+ git clone https://github.com/rikutoyamada01/license-trace.git
15
+ cd license-trace
16
+ cargo test
17
+ ```
18
+
19
+ ## Pull Request Guidelines
20
+
21
+ 1. **Create a branch:** Create a feature or bugfix branch off `master` (e.g. `feat/new-ecosystem-resolver` or `fix/spdx-eval-edge-case`).
22
+ 2. **Code Standards:**
23
+ - Format code using standard rustfmt:
24
+ ```bash
25
+ cargo fmt --all -- --check
26
+ ```
27
+ - Ensure zero Clippy warnings:
28
+ ```bash
29
+ cargo clippy --all-targets --all-features -- -D warnings
30
+ ```
31
+ 3. **Tests:**
32
+ - Add unit tests for all new resolvers, parser edge-cases, or policy rules.
33
+ - Run the full test suite:
34
+ ```bash
35
+ cargo test --all-targets --all-features
36
+ ```
37
+ 4. **Third-Party Notices:**
38
+ - If adding dependencies to `Cargo.toml`, ensure they are Permissive and run `license-trace export --output THIRD_PARTY_LICENSES.md` to refresh the notice bundle.
39
+
40
+ ## Commit Message Convention
41
+
42
+ We follow conventional commit guidelines (e.g., `feat: ...`, `fix: ...`, `docs: ...`, `refactor: ...`, `test: ...`).
43
+ Include GitHub issue reference keywords (e.g. `Closes #123`) when resolving open issues.