docs/cmd/genlicenses.md

genlicenses — third-party legal-notice generator

cmd/genlicenses builds the committed legal notice embedded in EzAgent; it is a build/developer tool and does not display the report at runtime. For the embedded API and version substitution, see pkg/buildinfo. For the user-facing --third-party-licenses option, see ez-agent and pkg/cli.

What does genlicenses own?

It discovers dependencies for the supported Go command binaries, applies the manually reviewed license policy, collects upstream legal files, validates explicitly registered bundled data, and renders a deterministic notice. Its module policy is in cmd/genlicenses/main.go; bundled-data registration is in cmd/genlicenses/assets.go.

RoleLocation
Generator and license-policy gatecmd/genlicenses/main.go
Explicit bundled-data componentscmd/genlicenses/assets.go
Generated notice (embedded at compile time)pkg/buildinfo/third_party_licenses.txt
Embed and report APIpkg/buildinfo/licenses.go
Regenerate/check entry pointsjustfile (licenses, licenses-check)

Coverage is the dependency union reported by go list -deps for the seven Go commands: ez-agent, ez-agent-service, ez-agent-builtin, ez-agent-hello, ez-agent-configurator, ez-agent-webfetch, and ez-agent-hub. It is not a list of every module declared in go.mod, nor a claim about every build output. The generator also adds one synthetic component for the active Go runtime and standard library.

Go module discovery cannot find licenses for embedded data. The generator therefore registers the EFF Large Wordlist for Passphrases as an explicit CC-BY-4.0 component. It checks the pinned word-list size, line count, and SHA-256, checks the full legal-text digest, and verifies the checksum file. It also includes the NOTICE in the report. Missing, empty, symlinked, or non-regular inputs fail generation. Changes to the pinned list, terms, or checksum fail immediately. A NOTICE change alters generated output and is caught by just licenses-check until the reviewed report is regenerated.

The separate Ruby companion ships its own notices through ez-agent-ruby --ez-runtime-notices. Its runtime build includes CRuby's legal texts, including Psych's MIT notice, plus the zlib and libyaml licenses. Those native dependencies are not Go modules and are not covered by this generator.

The notice contains a summary and the complete copied legal text for each component. Components identify their module, version, and classification; the header retains {{EZAGENT_VERSION}} for runtime substitution.

How do I refresh or check the notice?

From the repository root, run just licenses to rewrite the committed artifact. Run just licenses-check to fail if fresh output differs byte-for-byte. The package's go:generate directive in pkg/buildinfo/licenses.go is an alternative, package-local entry point. Relative -output paths resolve from the invocation directory: use the repository root with just licenses, or pkg/buildinfo with go generate.

just build does not refresh or check this artifact. Refresh it deliberately when a covered dependency, toolchain notice, bundled data file, or generator policy changes.

What must I update when dependencies or notices change?

  • Every discovered external module needs one current, explicit classification; missing classifications and stale map entries both fail generation. This is a review gate, not inferred license detection.
  • Replaced modules, missing versions or module directories, and absent legal files fail. Notice discovery accepts only regular, non-symlink module-root files named LICENSE, LICENCE, COPYING, or NOTICE (with permitted suffixes). Go-reported module/toolchain directories and their ancestors are trusted paths and may be symlinked; individual legal-file symlinks still fail.
  • Legal-file and component order is deterministic, but legal-file bytes are preserved—including a missing final newline. Composite classifications are supported and tested.
  • Keep the generated file committed: go:embed makes it a compile-time input; the runtime never reads a source-tree notice file.
  • For registered data, update the reviewed digest constants in assets.go only after reviewing the new source bytes and legal terms. Keep the data, attribution, checksum, and complete license text together under the registered asset directory.

How does the notice reach users?

pkg/buildinfo/licenses.go embeds the artifact and substitutes the build version. pkg/cli/main.go prints that report for ez-agent --third-party-licenses before daemon probing or configuration access, so reporting does not require either.

Where do the tests and full detail live?

Read the generator and its tests for policy and edge cases: cmd/genlicenses/main_test.go, cmd/genlicenses/assets_test.go, pkg/buildinfo/buildinfo_test.go, and pkg/cli/licenses_test.go. The committed notice artifact is the exact rendered output.

The SIWC implementation uses the approved github.com/coreos/go-oidc/v3 module under Apache-2.0, with its required github.com/go-jose/go-jose/v4 Apache-2.0 and golang.org/x/oauth2 BSD-3-Clause dependencies. Their complete upstream legal files are included through the same generator, including applicable NOTICE material when present. EzAgent's BSD-2-Clause LICENSE is unchanged. No OpenAI SDK, SIWC DevKit code, documentation, or assets are bundled by this integration.