GeezerVison is showing github.com — docs: add third-party license notices by jdx · Pull Request #1174 · jdx/usage
Conversation
jdx
commented
Aug 21, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Usage's derive vocabulary, help output shape, and diagnostic conventions deliberately mirror clap so that clap CLIs can be ported field by field — but nothing in the tree said so, or reproduced clap's license. This adds a NOTICE.md that does, and covers the rest of the third-party material I found while writing it.
What's in NOTICE.md
- clap — design attribution (derive attribute vocabulary, output shape,
clap_usage's use of clap's public API) plus clap's MIT text. clap is dual MIT/Apache-2.0; taken under the MIT option to match usage's own license. The text is byte-for-byte from clap-4.6.6/LICENSE-MIT, the version this workspace locks.
- bash-completion — see below.
- fd, tokei, starship — the external adopter probes under
benches/shadows/external-* carry each upstream's declaration shapes and help text verbatim (the long_help strings are copied), so each upstream's license is reproduced at the revision benches/external/README.md pins. Every license text was fetched at that pinned revision and diffed to confirm it's verbatim.
The bash-completion finding
lib/bash-completion/bash_completion is a verbatim vendored copy of scop/bash-completion 2.15.0. lib/src/complete/bash.rs embeds it with include_str!, so it is redistributed in the usage-lib crate and in every binary built from it.
It is GPL-2.0-or-later, not MIT — and its COPYING was not in usage-lib's include list, so the published crate shipped the script without its license. This PR adds /bash-completion/COPYING (and upstream's README.md) to include, and notes the terms at the include_str! site.
Decided: #1176 removes the vendored copy for 6.x, which drops the bash-completion section of NOTICE.md and the COPYING entry added here. This PR still stands on its own for the clap/fd/tokei/starship notices, and keeps the tree compliant if #1176 takes longer to land.
Original note, for the record:
This leaves a decision for you that I deliberately did not make: usage-lib declares license = "MIT" while bundling GPL-2.0-or-later text into its published artifact. The options are roughly (a) declare the real SPDX expression on usage-lib, (b) stop vendoring the script and have --include-bash-completion-lib source the system copy, or (c) move the vendored copy behind an optional feature so the default artifact is MIT-only. Worth a look before the next release.
Shipping it with the crates
NOTICE.md is symlinked into all nine publishable crates and added to the three include lists that exist (lib, cli, clap_usage). Verified with cargo package --list that every crate now ships it, and that usage-lib ships bash-completion/COPYING:
for c in usage-lib usage-cli clap_usage usage-argv usage-config usage-config-build usage-derive usage-rs usage-validation; do cargo package -p $c --list --allow-dirty | grep -E "NOTICE|COPYING"; done
Cargo dereferences the symlink when packaging (confirmed against a scratch crate: the tarball contains a regular file with the content), and release-plz publishes from ubuntu-latest, so the symlink resolves at publish time.
Also referenced from
README.md — new Acknowledgements and License sections; the README previously had neither
docs/rust/clap-compatibility.md — next to the "updating clap requires re-auditing this matrix" note
benches/external/README.md — a reminder to update NOTICE.md when a pinned revision moves
cargo build --all and cargo clippy -p usage-lib --all-features are clean. No version fields touched.
This PR description was generated by Claude Code.
Note Medium Risk
Documentation and crate include lists only, but it surfaces that usage-lib still ships GPL-2.0-or-later bash-completion while declaring MIT. License metadata is not changed.
Overview
Adds a repo-root NOTICE.md covering clap design attribution (MIT), the vendored GPL-2.0-or-later bash-completion script, and licenses for the fd/tokei/starship adopter probes.
NOTICE.md is linked into the publishable crates and added to include for usage-lib, usage-cli, and clap_usage. usage-lib now also packages bash-completion/COPYING (and README) with the embedded script.
README, clap-compatibility docs, and the external-probe audit point at the notices. A comment at the include_str! site records the GPL terms. Crate license fields stay MIT.
Reviewed by Cursor Bugbot for commit 2c4a1c0. Bugbot is set up for automated code reviews on this repo. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Usage's derive vocabulary, help output shape, and diagnostic conventions
deliberately mirror clap so clap CLIs can be ported field by field, but nothing
in the tree said so or reproduced clap's license. Add a NOTICE.md that does, and
cover the rest of the third-party material found while writing it:
- clap: design attribution plus its MIT text (taken under the MIT option of its
MIT/Apache-2.0 dual license), verbatim from clap 4.6.6's LICENSE-MIT.
- bash-completion: lib/bash-completion/bash_completion is a verbatim vendored
copy, embedded with include_str! and redistributed in the usage-lib crate and
every binary built from it. It is GPL-2.0-or-later, and its COPYING was not in
usage-lib's `include` list, so the published crate shipped the script without
its license. Add COPYING (and upstream's README) to `include`, and note the
terms at the include_str! site.
- fd, tokei, starship: the external adopter probes under benches/shadows carry
each upstream's declaration shapes and help text verbatim, so reproduce each
license at the revision benches/external/README.md pins.
NOTICE.md is symlinked into every publishable crate and added to the `include`
lists that have one, so it ships in all nine crate tarballs.
Co-Authored-By: Claude Opus 5 <[email protected]>
Warning
Review limit reached
@jdx, you've reached your PR review limit, so we couldn't start this review.
Next review available in: 7 minutes
Limit details: You’ve used all 4 included reviews currently available.
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
How can I continue?
Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.
An organization admin can change what happens after included review limits in Billing.
How do review limits work?
CodeRabbit enforces per-developer PR review limits within each organization.
For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.
Please refer docs for additional details.
Review details
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 1994014c-277a-4090-9ece-c9929e062315
📥 Commits
Reviewing files that changed from the base of the PR and between fe215f5 and 2c4a1c0.
📒 Files selected for processing (17)
NOTICE.md
README.md
argv/NOTICE.md
benches/external/README.md
clap_usage/Cargo.toml
clap_usage/NOTICE.md
cli/Cargo.toml
cli/NOTICE.md
config-build/NOTICE.md
config/NOTICE.md
derive/NOTICE.md
docs/rust/clap-compatibility.md
lib/Cargo.toml
lib/NOTICE.md
lib/src/complete/bash.rs
usage-rs/NOTICE.md
validation/NOTICE.md
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Instruction counts
| benchmark |
trend |
instructions |
Δ |
wall (min) |
Δ |
| markdown |
▁█▇▇▇ |
226,083,772 → 226,034,052 |
-0.02% |
22.49 → 22.83ms |
+1.50% |
| startup |
▁▇███ |
1,225,065 → 1,225,070 |
+0.00% |
1.44 → 1.57ms |
+9.23% |
No instruction-count regression above 1%.
Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.
Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
Shadow comparison
Parsing mise use -g node@20 against a shadow of mise's committed spec.
Reported, not gated: the shadow grows as the derive learns to express more, so
what to watch is the ratio rather than either column.
| framework |
instructions, cold parse |
vs usage |
| usage |
8315 |
— |
| argh |
6307 |
0.8x |
| clap |
6316072 |
759x |
| bpaf |
21909147 |
2634x |
min p01 p10 median
usage-rs: argv -> struct 423 430 438 452 ns
argh: argv -> struct 289 295 301 313 ns
clap: build tree + parse -> struct 527528 529880 534076 547912 ns
bpaf: build parser + parse -> struct 1632628 1632628 1643044 1676442 ns
usage: argv -> struct 429 ns 0.43 µs
clap: build tree + parse -> struct 585625 ns 585.62 µs
clap: parse -> struct, tree reused 26307 ns 26.31 µs
clap: build tree only 343126 ns 343.13 µs
2c4a1c0b7621 vs 298a0f54556c · measured on the runner, not pushed to the history.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jdx
added a commit
that referenced
this pull request
Aug 21, 2026
Follow-up to #1174, which surfaced this. Stacked on it, so GitHub will
retarget this to `main` when #1174 merges.
`lib/bash-completion/bash_completion` was a verbatim copy of
scop/bash-completion 2.15.0, embedded with `include_str!` and emitted by
`--include-bash-completion-lib`. It's GPL-2.0-or-later, which meant an
MIT-declared `usage-lib` was redistributing GPL text in its published
artifact and in every binary built from it. Since 6.x is going out
anyway, this removes it rather than papering over it with an SPDX
expression or a feature flag.
**Removed:** the vendored script,
`CompleteOptions::include_bash_completion_lib`, and the
`--include-bash-completion-lib` flag on `usage generate completion`.
## It also fixes a bug the vendored copy was hiding
CI caught this once the system library stopped being shadowed:
`ubuntu-latest` is 24.04, which ships bash-completion **2.11**, and 2.11
defines none of `_comp_initialize`, `_comp_compgen`, or
`_comp_ltrim_colon_completions` — those are the 2.12 renames the
generated script called. So usage-generated bash completions have never
worked on the current LTS unless `--include-bash-completion-lib`
injected the vendored 2.15 copy.
The script now emits the pre-2.12 spellings (`_init_completion`,
`__ltrim_colon_completions`, plain `compgen -W … -- "$cur"`), which
2.12+ still support through their compat layer. That covers 2.11 through
2.16 rather than trading one broken range for another, and it is
verified end to end against real libraries at both ends. CI stays on
24.04's 2.11 deliberately — it is the floor being claimed, and 26.04's
2.16 would pass either way.
## The generated script already required bash-completion
Worth being explicit about, because it makes this less of a functional
loss than it looks: the completion body calls `_comp_initialize`,
`_comp_compgen` and `_comp_ltrim_colon_completions`. Those come from
bash-completion. So anyone who generated a completion *without* the flag
already needed it installed — the flag was a convenience for
self-contained scripts, not the thing that made bash completions work.
What changes is that it's now the only path, so the generated script
says so in a header comment and guards for it, in the same shape as the
existing "usage CLI not found" guard:
```
Error: bash-completion 2.12+ is required for testcli completions but was not loaded.
Install it from your package manager and source it before this script.
```
Previously that state surfaced as `_init_completion: command not found`.
## Tests and CI
`test_bash_completion_integration` sources the system bash-completion
instead of the embedded copy. Finding it is a new
`bash_completion_or_skip`, which panics under `CI` for the same reason
`skip_if_shell_missing` does — a bash suite that quietly skipped its
only end-to-end completion test would report green having exercised
nothing. The workflow's apt step installs `bash-completion` to keep that
honest.
Verified locally both ways: with a real bash-completion 2.16 on the
search path and `CI=1`, the test runs and completes (`GOT_COMPLETIONS`,
`COMPLETION_SUB_FOUND`); without one and `CI=1`, it panics rather than
skipping.
New `test_bash_guard_reports_missing_bash_completion` covers the guard,
including that it fires *before* bash reports a missing function.
## Downstream note
mise's own `mise completion bash --include-bash-completion-lib` passes
this option through, and mise's help text recommends that invocation.
It'll need updating when mise moves to usage 6.x — flagging it since
it's the one known caller.
`mise run lint`, `mise run render`, and `cargo test -p usage-lib -p
usage-cli -p usage-conformance --all-features` are clean. `cargo package
-p usage-lib --list` no longer contains any bash-completion file. No
version fields touched.
_This PR description was generated by Claude Code._
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Breaking public API: generated bash completions no longer embed
bash-completion, and `--include-bash-completion-lib` is removed.
Downstream CLIs (notably mise) and users without a system
bash-completion will need to update.
>
> **Overview**
> Stops shipping a GPL copy of bash-completion inside the MIT crate.
Generated bash scripts now expect the system library to be sourced
first.
>
> Removes `--include-bash-completion-lib` and
`CompleteOptions::include_bash_completion_lib`. The generated script
guards for `_init_completion` with a clear error instead of `command not
found`.
>
> Also switches the generated helpers to the **pre-2.12** names
(`_init_completion`, `__ltrim_colon_completions`, `compgen -W`) so
completions work on Ubuntu 24.04’s bash-completion **2.11**, which the
vendored 2.15 copy had been hiding. CI installs the distro package and
tests against that floor; a new test covers the missing-library guard.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8db85bb. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|