libtea 0.1.1__tar.gz → 0.2.0__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 (57) hide show
  1. {libtea-0.1.1 → libtea-0.2.0}/.github/workflows/ci.yaml +3 -2
  2. {libtea-0.1.1 → libtea-0.2.0}/.github/workflows/pypi.yaml +5 -0
  3. {libtea-0.1.1 → libtea-0.2.0}/.gitignore +1 -0
  4. libtea-0.2.0/.pre-commit-config.yaml +15 -0
  5. libtea-0.2.0/CLAUDE.md +93 -0
  6. {libtea-0.1.1 → libtea-0.2.0}/PKG-INFO +221 -43
  7. {libtea-0.1.1 → libtea-0.2.0}/README.md +214 -40
  8. libtea-0.2.0/docs/FUTURE.md +23 -0
  9. libtea-0.2.0/docs/cli.md +347 -0
  10. libtea-0.2.0/docs/plans/2025-02-25-tea-client-design.md +218 -0
  11. libtea-0.2.0/docs/plans/2026-02-25-v0.2.0-design.md +745 -0
  12. libtea-0.2.0/docs/plans/2026-02-26-v0.3.0-design.md +710 -0
  13. {libtea-0.1.1 → libtea-0.2.0}/pyproject.toml +31 -5
  14. {libtea-0.1.1 → libtea-0.2.0/src}/libtea/__init__.py +38 -1
  15. libtea-0.2.0/src/libtea/_cli_entry.py +17 -0
  16. libtea-0.2.0/src/libtea/_cli_fmt.py +542 -0
  17. libtea-0.2.0/src/libtea/_hashing.py +63 -0
  18. libtea-0.2.0/src/libtea/_http.py +378 -0
  19. libtea-0.2.0/src/libtea/_security.py +91 -0
  20. libtea-0.2.0/src/libtea/_validation.py +82 -0
  21. libtea-0.2.0/src/libtea/cli.py +623 -0
  22. {libtea-0.1.1 → libtea-0.2.0/src}/libtea/client.py +209 -51
  23. libtea-0.2.0/src/libtea/discovery.py +264 -0
  24. libtea-0.2.0/src/libtea/exceptions.py +97 -0
  25. libtea-0.2.0/src/libtea/models.py +533 -0
  26. libtea-0.2.0/tests/cli/__init__.py +0 -0
  27. libtea-0.2.0/tests/cli/test_cli.py +1274 -0
  28. libtea-0.2.0/tests/cli/test_cli_fmt.py +953 -0
  29. libtea-0.2.0/tests/client/__init__.py +0 -0
  30. libtea-0.2.0/tests/client/test_client.py +762 -0
  31. {libtea-0.1.1/tests → libtea-0.2.0/tests/client}/test_discovery.py +251 -70
  32. {libtea-0.1.1/tests → libtea-0.2.0/tests/client}/test_download.py +14 -0
  33. {libtea-0.1.1/tests → libtea-0.2.0/tests/client}/test_http.py +227 -86
  34. libtea-0.2.0/tests/integration/__init__.py +0 -0
  35. libtea-0.2.0/tests/unit/__init__.py +0 -0
  36. libtea-0.2.0/tests/unit/test_cli_entry.py +21 -0
  37. libtea-0.2.0/tests/unit/test_hashing.py +60 -0
  38. {libtea-0.1.1/tests → libtea-0.2.0/tests/unit}/test_models.py +234 -11
  39. libtea-0.2.0/tests/unit/test_security.py +198 -0
  40. libtea-0.2.0/tests/unit/test_validation.py +122 -0
  41. {libtea-0.1.1 → libtea-0.2.0}/uv.lock +240 -24
  42. libtea-0.1.1/.pre-commit-config.yaml +0 -7
  43. libtea-0.1.1/CLAUDE.md +0 -30
  44. libtea-0.1.1/libtea/_http.py +0 -257
  45. libtea-0.1.1/libtea/discovery.py +0 -224
  46. libtea-0.1.1/libtea/exceptions.py +0 -58
  47. libtea-0.1.1/libtea/models.py +0 -330
  48. libtea-0.1.1/tests/test_client.py +0 -469
  49. {libtea-0.1.1 → libtea-0.2.0}/.github/dependabot.yml +0 -0
  50. {libtea-0.1.1 → libtea-0.2.0}/.github/workflows/codeql.yaml +0 -0
  51. {libtea-0.1.1 → libtea-0.2.0}/LICENSE +0 -0
  52. {libtea-0.1.1 → libtea-0.2.0/src}/libtea/py.typed +0 -0
  53. {libtea-0.1.1 → libtea-0.2.0}/tests/__init__.py +0 -0
  54. {libtea-0.1.1 → libtea-0.2.0}/tests/conftest.py +0 -0
  55. {libtea-0.1.1/tests → libtea-0.2.0/tests/integration}/test_integration.py +0 -0
  56. {libtea-0.1.1/tests → libtea-0.2.0/tests/unit}/test_exceptions.py +0 -0
  57. {libtea-0.1.1/tests → libtea-0.2.0/tests/unit}/test_version.py +0 -0
@@ -15,7 +15,8 @@ jobs:
15
15
  - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16
16
  - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
17
17
  - run: uv python install ${{ matrix.python-version }}
18
- - run: uv sync
18
+ - run: uv sync --extra cli
19
19
  - run: uv run ruff check .
20
20
  - run: uv run ruff format --check .
21
- - run: uv run pytest --cov=libtea --cov-report=term-missing
21
+ - run: uv run pytest --cov-fail-under=90
22
+ - run: uv build
@@ -53,6 +53,11 @@ jobs:
53
53
 
54
54
  - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
55
55
 
56
+ - name: Run tests
57
+ run: |
58
+ uv sync --extra cli
59
+ uv run pytest --cov-fail-under=90
60
+
56
61
  - name: Build package
57
62
  run: uv build
58
63
 
@@ -46,6 +46,7 @@ htmlcov/
46
46
  nosetests.xml
47
47
  coverage.xml
48
48
  *.cover
49
+ *,cover
49
50
  *.py.cover
50
51
  .hypothesis/
51
52
  .pytest_cache/
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.15.0
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+ - repo: local
9
+ hooks:
10
+ - id: mypy
11
+ name: mypy
12
+ entry: uv run mypy
13
+ language: system
14
+ types: [python]
15
+ pass_filenames: false
libtea-0.2.0/CLAUDE.md ADDED
@@ -0,0 +1,93 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ **py-libtea** is a hand-crafted Python client library for the Transparency Exchange API (TEA) v0.3.0-beta.2. Consumer-focused (read-only); publisher API is not yet supported (blocked on TEA spec). Licensed Apache 2.0, maintained under sbomify.
8
+
9
+ ## Build & Dev Commands
10
+
11
+ ```bash
12
+ uv sync # Install all dependencies
13
+ uv run pytest # Run full test suite with coverage
14
+ uv run pytest tests/client/test_client.py -v # Run a single test file
15
+ uv run pytest tests/unit/test_security.py::TestSsrfProtection::test_rejects_cgnat_ip -v # Single test
16
+ uv run mypy # Type check (strict mode)
17
+ uv run ruff check . # Lint
18
+ uv run ruff format --check . # Format check
19
+ uv run ruff format . # Auto-format
20
+ uv build # Build wheel and sdist
21
+ ```
22
+
23
+ ## Code Conventions
24
+
25
+ - **Layout**: src/ layout (`src/libtea/`), hatchling build backend
26
+ - **Python**: >=3.11 (enables `StrEnum`, `X | Y` union syntax)
27
+ - **Line length**: 120, ruff rules: E, F, I
28
+ - **Models**: Pydantic v2 with `frozen=True`, `extra="ignore"`, `alias_generator=to_camel`
29
+ - **HTTP mocking**: `responses` library (not `unittest.mock` for HTTP)
30
+ - **Coverage**: Branch coverage enabled, target ~97%
31
+
32
+ ## Architecture
33
+
34
+ The library has a layered design with strict separation of concerns:
35
+
36
+ ```
37
+ __init__.py Public API re-exports (all models, exceptions, client, discovery)
38
+ client.py TeaClient — high-level consumer API, checksum verification
39
+ ↓ uses
40
+ _validation.py Input validation helpers (path segments, page size/offset, Pydantic wrappers)
41
+ _http.py TeaHttpClient — low-level requests wrapper, auth, streaming downloads
42
+ Also: probe_endpoint() for endpoint failover
43
+ _security.py SSRF protection (_validate_download_url, DNS rebinding checks, internal IP detection)
44
+ _hashing.py Checksum hash builders (SHA-*, BLAKE2b-*, MD5)
45
+ discovery.py TEI parsing, .well-known/tea fetching, SemVer endpoint selection, redirect SSRF protection
46
+ models.py Pydantic v2 models for all TEA domain objects (frozen, camelCase aliases)
47
+ exceptions.py Exception hierarchy (all inherit from TeaError)
48
+ cli.py click CLI (optional dependency, thin wrapper over TeaClient)
49
+ _cli_fmt.py Rich output formatters for all CLI commands (tables, panels, escape helpers)
50
+ _cli_entry.py Entry point wrapper that handles missing CLI extras gracefully
51
+ ```
52
+
53
+ **Key design patterns:**
54
+
55
+ - `TeaClient` delegates all HTTP to `TeaHttpClient` — never calls `requests` directly
56
+ - Bearer tokens are NOT sent to artifact download URLs (separate unauthenticated session prevents token leakage to CDNs)
57
+ - Downloads follow redirects manually with SSRF validation at each hop
58
+ - Discovery redirects are validated against internal networks (SSRF protection via `_security._validate_download_url`)
59
+ - `_validation._validate()` wraps Pydantic `ValidationError` into `TeaValidationError` so all client errors are `TeaError` subclasses
60
+ - Endpoint failover: `from_well_known()` probes candidates in priority order, skipping unreachable ones
61
+ - `probe_endpoint()` lives in `_http.py` (not `client.py`) to maintain the HTTP layer boundary
62
+ - `_raise_for_status()` uses bounded reads (201 bytes) for error body snippets to avoid memory issues on streaming responses
63
+ - CLI formatters in `_cli_fmt.py` escape all server-controlled strings with `rich.markup.escape()` to prevent Rich markup injection
64
+
65
+ **Auth**: Bearer token and basic auth are supported. Token and basic_auth are mutually exclusive. HTTP (non-TLS) with credentials is rejected.
66
+
67
+ ## Critical Implementation Rules
68
+
69
+ - **NEVER** use `from __future__ import annotations` in files containing Pydantic models — it breaks Pydantic v2 runtime type evaluation
70
+ - `pydantic >= 2.1.0` is the floor (for `pydantic.alias_generators.to_camel`)
71
+ - `requests` auto-encodes query params — do NOT pre-encode with `urllib.parse.quote()`
72
+ - When mocking with `responses` library, use `requests.ConnectionError` as the body exception (not Python's built-in `ConnectionError` — they are different classes)
73
+ - `ChecksumAlgorithm` values may arrive as `SHA_256` (underscore) or `SHA-256` (hyphen) from servers — the `@field_validator` in `Checksum` normalizes both
74
+ - BLAKE3 is in the enum for spec completeness but NOT supported at runtime (not in stdlib `hashlib`) — raises `TeaChecksumError`
75
+ - `Identifier.id_type` is typed as `str` (not `IdentifierType` enum) so unknown types from future spec versions pass through
76
+ - CGNAT range (100.64.0.0/10, RFC 6598) is checked separately in SSRF protection because `ipaddress.is_private` misses it on Python 3.11+
77
+
78
+ ## TEA Spec Reference
79
+
80
+ The TEA spec repo should be cloned to `/tmp/transparency-exchange-api/` for cross-referencing:
81
+
82
+ ```bash
83
+ git clone https://github.com/CycloneDX/transparency-exchange-api /tmp/transparency-exchange-api
84
+ ```
85
+
86
+ Key spec files: `spec/openapi.yaml`, `discovery/readme.md`, `auth/readme.md`
87
+
88
+ ## Design Docs
89
+
90
+ - `docs/plans/2025-02-25-tea-client-design.md` — v0.1.0 original design
91
+ - `docs/plans/2026-02-25-v0.2.0-design.md` — v0.2.0 (CLE, SemVer, failover, CLI)
92
+ - `docs/plans/2026-02-26-v0.3.0-design.md` — v0.3.0 (httpx migration, async client)
93
+ - `docs/FUTURE.md` — Items blocked on external factors (Publisher API)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libtea
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: Python client library for the Transparency Exchange API (TEA)
5
5
  Project-URL: Homepage, https://github.com/sbomify/py-libtea
6
6
  Project-URL: Repository, https://github.com/sbomify/py-libtea
@@ -22,8 +22,12 @@ Classifier: Programming Language :: Python :: 3.13
22
22
  Classifier: Topic :: Security
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
24
  Requires-Python: >=3.11
25
- Requires-Dist: pydantic<3,>=2.12.0
26
- Requires-Dist: requests<3,>=2.32.0
25
+ Requires-Dist: pydantic<3,>=2.1.0
26
+ Requires-Dist: requests<3,>=2.32.4
27
+ Requires-Dist: semver<4,>=3.0.4
28
+ Provides-Extra: cli
29
+ Requires-Dist: click<9,>=8.0; extra == 'cli'
30
+ Requires-Dist: rich>=13.0.0; extra == 'cli'
27
31
  Description-Content-Type: text/markdown
28
32
 
29
33
  # libtea
@@ -46,10 +50,14 @@ TEA is an open standard for discovering and retrieving software transparency art
46
50
  - Auto-discovery via `.well-known/tea` and TEI URNs
47
51
  - Products, components, releases, and versioned collections
48
52
  - Search by PURL, CPE, or TEI identifier
53
+ - Common Lifecycle Enumeration (CLE) — ECMA-428 lifecycle events
49
54
  - Artifact download with on-the-fly checksum verification (MD5 through BLAKE2b)
55
+ - Endpoint failover with SemVer-compatible version selection
56
+ - Bearer token and HTTP basic auth authentication
57
+ - Bearer token isolation — tokens are never sent to artifact download hosts
50
58
  - Typed Pydantic v2 models with full camelCase/snake_case conversion
51
59
  - Structured exception hierarchy with error context
52
- - Bearer token isolation — tokens are never sent to artifact download hosts
60
+ - CLI with rich-formatted output and JSON mode
53
61
 
54
62
  ## Installation
55
63
 
@@ -57,28 +65,36 @@ TEA is an open standard for discovering and retrieving software transparency art
57
65
  pip install libtea
58
66
  ```
59
67
 
68
+ To include the CLI (`tea-cli`):
69
+
70
+ ```bash
71
+ pip install libtea[cli]
72
+ ```
73
+
60
74
  ## Quick start
61
75
 
62
76
  ```python
63
77
  from libtea import TeaClient
64
78
 
65
- # Auto-discover from a domain's .well-known/tea
66
- with TeaClient.from_well_known("example.com", token="your-bearer-token") as client:
67
- # Browse a product
68
- product = client.get_product("product-uuid")
69
- print(product.name)
79
+ # Auto-discover the sbomify TEA server from its .well-known/tea
80
+ with TeaClient.from_well_known("trust.sbomify.com", token="your-bearer-token") as client:
81
+ # Discover a product by TEI
82
+ results = client.discover(
83
+ "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
84
+ )
85
+ for info in results:
86
+ print(info.product_release_uuid, info.servers)
70
87
 
71
- # Get a component release with its latest collection
72
- cr = client.get_component_release("release-uuid")
73
- for artifact in cr.latest_collection.artifacts:
74
- print(artifact.name, artifact.type)
88
+ # Get a product release
89
+ pr = client.get_product_release(results[0].product_release_uuid)
90
+ print(pr.version, pr.product_name)
75
91
  ```
76
92
 
77
93
  Or connect directly to a known endpoint:
78
94
 
79
95
  ```python
80
96
  client = TeaClient(
81
- base_url="https://api.example.com/tea/v0.3.0-beta.2",
97
+ base_url="https://trust.sbomify.com/tea/v0.3.0-beta.2",
82
98
  token="your-bearer-token",
83
99
  timeout=30.0,
84
100
  )
@@ -88,7 +104,7 @@ Using `from_well_known`, you can also override the spec version and timeout:
88
104
 
89
105
  ```python
90
106
  client = TeaClient.from_well_known(
91
- "example.com",
107
+ "trust.sbomify.com",
92
108
  token="your-bearer-token",
93
109
  timeout=15.0,
94
110
  version="0.3.0-beta.2", # default
@@ -97,18 +113,50 @@ client = TeaClient.from_well_known(
97
113
 
98
114
  ## Usage
99
115
 
116
+ ### Discovery
117
+
118
+ ```python
119
+ from libtea import TeaClient
120
+
121
+ # Discover sbomify products via TEI
122
+ with TeaClient.from_well_known("trust.sbomify.com") as client:
123
+ results = client.discover(
124
+ "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
125
+ )
126
+ for info in results:
127
+ print(info.product_release_uuid, info.servers)
128
+ ```
129
+
130
+ Low-level discovery functions are also available:
131
+
132
+ ```python
133
+ from libtea.discovery import parse_tei, fetch_well_known, select_endpoint
134
+
135
+ # Parse a TEI URN
136
+ tei_type, domain, identifier = parse_tei(
137
+ "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
138
+ )
139
+
140
+ # Fetch and select an endpoint manually
141
+ well_known = fetch_well_known("trust.sbomify.com")
142
+ endpoint = select_endpoint(well_known, "0.3.0-beta.2")
143
+ print(endpoint.url, endpoint.priority)
144
+ ```
145
+
146
+ Supported TEI types: `uuid`, `purl`, `hash`, `swid`, `eanupc`, `gtin`, `asin`, `udi`.
147
+
100
148
  ### Search
101
149
 
102
150
  ```python
103
- with TeaClient.from_well_known("example.com") as client:
151
+ with TeaClient.from_well_known("trust.sbomify.com") as client:
104
152
  # Search by PURL
105
- results = client.search_products("PURL", "pkg:pypi/requests")
153
+ results = client.search_products("PURL", "pkg:github/sbomify/sbomify")
106
154
  for product in results.results:
107
155
  print(product.name, product.uuid)
108
156
 
109
157
  # Search product releases (with pagination)
110
158
  releases = client.search_product_releases(
111
- "PURL", "pkg:pypi/requests@2.31.0",
159
+ "PURL", "pkg:github/sbomify/sbomify",
112
160
  page_offset=0, page_size=100,
113
161
  )
114
162
  print(releases.total_results)
@@ -117,7 +165,7 @@ with TeaClient.from_well_known("example.com") as client:
117
165
  ### Products and releases
118
166
 
119
167
  ```python
120
- with TeaClient.from_well_known("example.com") as client:
168
+ with TeaClient.from_well_known("trust.sbomify.com") as client:
121
169
  product = client.get_product("product-uuid")
122
170
  print(product.name, product.identifiers)
123
171
 
@@ -138,7 +186,7 @@ with TeaClient.from_well_known("example.com") as client:
138
186
  ### Components
139
187
 
140
188
  ```python
141
- with TeaClient(base_url="https://api.example.com/tea/v0.3.0-beta.2") as client:
189
+ with TeaClient.from_well_known("trust.sbomify.com") as client:
142
190
  component = client.get_component("component-uuid")
143
191
  releases = client.get_component_releases("component-uuid")
144
192
 
@@ -150,7 +198,7 @@ with TeaClient(base_url="https://api.example.com/tea/v0.3.0-beta.2") as client:
150
198
  ### Collections and artifacts
151
199
 
152
200
  ```python
153
- with TeaClient(base_url="https://api.example.com/tea/v0.3.0-beta.2") as client:
201
+ with TeaClient.from_well_known("trust.sbomify.com") as client:
154
202
  collection = client.get_component_release_collection_latest("release-uuid")
155
203
  for artifact in collection.artifacts:
156
204
  print(artifact.name, artifact.type)
@@ -167,7 +215,7 @@ with TeaClient(base_url="https://api.example.com/tea/v0.3.0-beta.2") as client:
167
215
  ```python
168
216
  from pathlib import Path
169
217
 
170
- with TeaClient(base_url="https://api.example.com/tea/v0.3.0-beta.2") as client:
218
+ with TeaClient.from_well_known("trust.sbomify.com") as client:
171
219
  artifact = client.get_artifact("artifact-uuid")
172
220
  fmt = artifact.formats[0]
173
221
 
@@ -183,29 +231,159 @@ Supported checksum algorithms: MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256,
183
231
 
184
232
  Artifact downloads use a separate unauthenticated HTTP session so the bearer token is never leaked to third-party hosts (CDNs, Maven Central, etc.). On checksum mismatch, the downloaded file is automatically deleted.
185
233
 
186
- ### Discovery
234
+ ### Common Lifecycle Enumeration (CLE)
187
235
 
188
236
  ```python
189
- from libtea.discovery import parse_tei, fetch_well_known, select_endpoint
237
+ with TeaClient.from_well_known("trust.sbomify.com") as client:
238
+ # Get lifecycle events for a product release
239
+ cle = client.get_product_release_cle("release-uuid")
240
+ for event in cle.events:
241
+ print(event.type, event.effective)
242
+
243
+ # CLE is available for all entity types
244
+ client.get_product_cle("product-uuid")
245
+ client.get_component_cle("component-uuid")
246
+ client.get_component_release_cle("release-uuid")
247
+ ```
190
248
 
191
- # Parse a TEI URN
192
- tei_type, domain, identifier = parse_tei(
193
- "urn:tei:purl:cyclonedx.org:pkg:pypi/cyclonedx-python-lib@8.4.0"
194
- )
249
+ ### Authentication
195
250
 
196
- # Low-level: fetch and select an endpoint manually
197
- well_known = fetch_well_known("example.com")
198
- endpoint = select_endpoint(well_known, "0.3.0-beta.2")
199
- print(endpoint.url, endpoint.priority)
251
+ ```python
252
+ from libtea import TeaClient
200
253
 
201
- # Discover product releases by TEI
202
- with TeaClient(base_url="https://api.example.com/tea/v0.3.0-beta.2") as client:
203
- results = client.discover("urn:tei:uuid:example.com:d4d9f54a-abcf-11ee-ac79-1a52914d44b")
204
- for info in results:
205
- print(info.product_release_uuid, info.servers)
254
+ # Bearer token
255
+ client = TeaClient.from_well_known("trust.sbomify.com", token="your-token")
256
+
257
+ # HTTP basic auth
258
+ client = TeaClient.from_well_known("trust.sbomify.com", basic_auth=("user", "password"))
206
259
  ```
207
260
 
208
- Supported TEI types: `uuid`, `purl`, `hash`, `swid`, `eanupc`, `gtin`, `asin`, `udi`.
261
+ ## CLI
262
+
263
+ The `tea-cli` command provides a terminal interface for all TEA operations. Install with `pip install libtea[cli]`. See the [full CLI reference](docs/cli.md) for detailed documentation.
264
+
265
+ ### Global options
266
+
267
+ ```
268
+ --json Output raw JSON instead of rich-formatted tables
269
+ --debug, -d Show debug output (HTTP requests, timing)
270
+ --version Show version
271
+ ```
272
+
273
+ All commands accept connection options: `--base-url`, `--domain`, `--token`, `--auth`, `--use-http`, `--port`.
274
+
275
+ ### Discover
276
+
277
+ ```bash
278
+ # Discover sbomify product releases via TEI
279
+ tea-cli discover "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
280
+
281
+ # UUIDs only (for scripting)
282
+ tea-cli discover -q "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
283
+
284
+ # JSON output
285
+ tea-cli --json discover "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
286
+ ```
287
+
288
+ ### Inspect (full flow)
289
+
290
+ ```bash
291
+ # TEI -> discovery -> releases -> components -> artifacts in one shot
292
+ tea-cli inspect "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
293
+
294
+ # Limit component resolution
295
+ tea-cli inspect --max-components 10 "urn:tei:purl:trust.sbomify.com:pkg:github/sbomify/sbomify"
296
+ ```
297
+
298
+ ### Search
299
+
300
+ ```bash
301
+ # Search products by PURL
302
+ tea-cli search-products --id-type PURL --id-value "pkg:github/sbomify/sbomify" \
303
+ --domain trust.sbomify.com
304
+
305
+ # Search product releases
306
+ tea-cli search-releases --id-type PURL --id-value "pkg:github/sbomify/sbomify" \
307
+ --domain trust.sbomify.com --page-size 50
308
+ ```
309
+
310
+ ### Products and releases
311
+
312
+ ```bash
313
+ # Get product details
314
+ tea-cli get-product <product-uuid> --domain trust.sbomify.com
315
+
316
+ # List releases for a product
317
+ tea-cli get-product-releases <product-uuid> --domain trust.sbomify.com
318
+
319
+ # Get a specific release (product or component)
320
+ tea-cli get-release <release-uuid> --domain trust.sbomify.com
321
+ tea-cli get-release <release-uuid> --component --domain trust.sbomify.com
322
+ ```
323
+
324
+ ### Components
325
+
326
+ ```bash
327
+ # Get component details
328
+ tea-cli get-component <component-uuid> --domain trust.sbomify.com
329
+
330
+ # List component releases
331
+ tea-cli get-component-releases <component-uuid> --domain trust.sbomify.com
332
+ ```
333
+
334
+ ### Collections and artifacts
335
+
336
+ ```bash
337
+ # Get latest collection (default) or specific version
338
+ tea-cli get-collection <release-uuid> --domain trust.sbomify.com
339
+ tea-cli get-collection <release-uuid> --version 3 --domain trust.sbomify.com
340
+
341
+ # List all collection versions
342
+ tea-cli list-collections <release-uuid> --domain trust.sbomify.com
343
+
344
+ # Get artifact metadata
345
+ tea-cli get-artifact <artifact-uuid> --domain trust.sbomify.com
346
+ ```
347
+
348
+ ### Download
349
+
350
+ ```bash
351
+ # Download an artifact with checksum verification
352
+ tea-cli download "https://cdn.example.com/sbom.json" ./sbom.json \
353
+ --checksum "SHA-256:abc123..." \
354
+ --domain trust.sbomify.com
355
+ ```
356
+
357
+ ### Lifecycle (CLE)
358
+
359
+ ```bash
360
+ # Get lifecycle events for different entity types
361
+ tea-cli get-cle <uuid> --entity product-release --domain trust.sbomify.com
362
+ tea-cli get-cle <uuid> --entity product --domain trust.sbomify.com
363
+ tea-cli get-cle <uuid> --entity component --domain trust.sbomify.com
364
+ tea-cli get-cle <uuid> --entity component-release --domain trust.sbomify.com
365
+ ```
366
+
367
+ ### Environment variables
368
+
369
+ | Variable | Description |
370
+ |----------|-------------|
371
+ | `TEA_BASE_URL` | TEA server base URL (alternative to `--base-url`) |
372
+ | `TEA_TOKEN` | Bearer token (alternative to `--token`) |
373
+ | `TEA_AUTH` | Basic auth as `USER:PASSWORD` (alternative to `--auth`) |
374
+
375
+ ### Shell completion
376
+
377
+ ```bash
378
+ # Bash (add to ~/.bashrc)
379
+ eval "$(_TEA_CLI_COMPLETE=bash_source tea-cli)"
380
+
381
+ # Zsh (add to ~/.zshrc)
382
+ eval "$(_TEA_CLI_COMPLETE=zsh_source tea-cli)"
383
+
384
+ # Fish (add to ~/.config/fish/completions/tea-cli.fish)
385
+ _TEA_CLI_COMPLETE=fish_source tea-cli | source
386
+ ```
209
387
 
210
388
  ## Error handling
211
389
 
@@ -241,16 +419,16 @@ Using a bearer token over plaintext HTTP raises `ValueError` immediately — HTT
241
419
  ## Requirements
242
420
 
243
421
  - Python >= 3.11
244
- - [requests](https://requests.readthedocs.io/) >= 2.31.0 for HTTP
422
+ - [requests](https://requests.readthedocs.io/) >= 2.32.4 for HTTP
245
423
  - [Pydantic](https://docs.pydantic.dev/) >= 2.1.0 for data models
424
+ - [semver](https://python-semver.readthedocs.io/) >= 3.0.4 for version selection
425
+
426
+ Optional (for CLI): [click](https://click.palletsprojects.com/) >= 8.0, [rich](https://rich.readthedocs.io/) >= 13.0.0
246
427
 
247
428
  ## Not yet supported
248
429
 
249
430
  - Publisher API (spec is consumer-only in beta.2)
250
- - Async client
251
- - CLE (Common Lifecycle Enumeration) endpoints
252
- - Mutual TLS (mTLS) authentication
253
- - Endpoint failover with retry
431
+ - Async client (httpx migration)
254
432
 
255
433
  ## Development
256
434