Metadata-Version: 2.4
Name: brewsorted-cli
Version: 0.8.4
Summary: Portable HTTP client for the BrewSorted API
Project-URL: Homepage, https://brewsorted.com
Project-URL: Documentation, https://brewsorted.com/downloads.html
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: httpx<1,>=0.28
Requires-Dist: PyJWT[crypto]<3,>=2.14
Provides-Extra: dev
Requires-Dist: pytest<10,>=8; extra == "dev"

# BrewSorted client bundle

This archive contains the HTTP CLI and the canonical User skill. It is paired
with its immutable service release by version, commit and archive SHA-256.
Public downloads use `client-release.json` and the client-only `SHA256SUMS` at
`https://downloads.brewsorted.com/index.json`; choose `production_recommended`,
not the newest published version. The supported client target
is Linux x86-64 with Python 3.12 or 3.13. Python 3.11 remains an internal
compatibility target and is not publicly release-qualified.

## PyPI installation

For releases published to [PyPI](https://pypi.org/project/brewsorted-cli/), install
that exact production-recommended version using uv (or pipx). Do not infer a
recommendation from PyPI's latest version. If the exact registry release is not
available yet, use its verified website archive below. The CLI and complete skill
are packaged together; no private repository access is required.

```bash
client_version=0.8.4
uv tool install --python python3.12 "brewsorted-cli==$client_version"
# Alternative: pipx install --python python3.12 "brewsorted-cli==$client_version"
brewsorted skills install --destination "$HOME/.codex/skills/brewsorted"
```

Python 3.13 is also supported. Choose your agent's actual discovery directory;
omitting `--destination` uses `~/.agents/skills/brewsorted`. Skill installation is
local and needs no sign-in or service access. It copies the complete matching
skill and records the executable version and file hashes in
`brewsorted-install.json`. Existing files, directories and symlinks are refused;
inspect and move an existing skill deliberately before installing a replacement.
After upgrading the executable, deliberately reinstall the matching skill.
Use the same protected credential-state setup and separate login described below,
invoking `brewsorted` from PATH for the PyPI installation.

PyPI Trusted Publishing uses our GitHub repository `bamx23/brewsorted`, workflow
`pypi-publish.yml` on `main`, and environment `pypi`. Publish attestations establish
publisher provenance; they do not certify code safety. Ordinary pip, pipx and uv
installs do not automatically verify those attestations. For explicit verification,
download the exact wheel, verify those bytes, then install that same local file:

```bash
python3.12 -m venv verification-env
verification-env/bin/python -m pip install pypi-attestations==0.0.31
verification-env/bin/python -m pip download --only-binary=:all: --no-deps \
  --dest verified "brewsorted-cli==$client_version"
verification-env/bin/python -m pypi_attestations verify pypi \
  --repository https://github.com/bamx23/brewsorted \
  "verified/brewsorted_cli-$client_version-py3-none-any.whl"
uv tool install --python python3.12 "verified/brewsorted_cli-$client_version-py3-none-any.whl"
```

This verifies the CLI artifact's repository provenance, not every dependency or
a security audit. Establish the expected repository identity independently of a
disputed website. The public download catalog remains the compatibility authority.

## Archive installation

After checking `SHA256SUMS`, retain the extracted immutable archive and install
both the CLI and its exact User skill. These commands use the Codex skill
directory; select the equivalent configured discovery directory for another
supported agent:

```bash
client_version=0.8.4
client_archive="brewsorted-client-${client_version}.tar.gz"
client_release_root="$HOME/.local/share/brewsorted/releases"
client_root="$client_release_root/brewsorted-client-${client_version}"
agent_skill_root="$HOME/.codex/skills"
sha256sum --check SHA256SUMS || exit 1
install -d -m 0700 "$client_release_root" "$agent_skill_root"
test ! -e "$client_root" && test ! -L "$client_root"
tar -xzf "$client_archive" -C "$client_release_root"
python3.13 -m venv "$client_root/.venv"
"$client_root/.venv/bin/python" -m pip install "$client_root"
test ! -e "$agent_skill_root/brewsorted" && test ! -L "$agent_skill_root/brewsorted"
ln -s "$client_root/skills/brewsorted" "$agent_skill_root/brewsorted"
```

For an upgrade from CoffeeTrack, remove the old `coffeetrack` skill link and
replace any shell or agent wrapper that invokes `coffeetrack` with the new
`$client_root/.venv/bin/brewsorted` path. Move the non-secret service-origin
setting from `COFFEETRACK_API_URL` to `BREWSORTED_API_URL`; use
`https://brewsorted.com` for production or `https://staging.brewsorted.com`
for synthetic staging. Use a separate credential file for each origin.
Do not copy an old `~/.local/state/coffeetrack/auth.json` or other OAuth state
into the BrewSorted state directory. The new realm has a different issuer and
requires fresh User setup, browser sign-in, and Connection authorization.

Do not copy only `SKILL.md`: the retained link keeps `references/cli.md` and the
acceptance scenarios paired with the installed executable source. If the target
link already exists, inspect and remove or rename it deliberately before linking
the new archive; do not overwrite an unknown directory.

Create the OAuth state directory explicitly and keep it user-owned mode `0700`.
The credential file becomes mode `0600` when login succeeds:

```bash
brewsorted_state_root="$HOME/.local/state/brewsorted"
install -d -m 0700 "$brewsorted_state_root"
export BREWSORTED_STATE_FILE="$brewsorted_state_root/auth.json"
export BREWSORTED_API_URL=https://brewsorted.com
unset COFFEETRACK_API_TOKEN COFFEETRACK_ACCESS_TOKEN COFFEETRACK_STATE_FILE
"$client_root/.venv/bin/brewsorted" status
```

Remove legacy `COFFEETRACK_*` assignments from shell profiles, agent wrappers,
and service configuration. `BREWSORTED_ACCESS_TOKEN` is only for an explicitly
configured transient agent session; it does not transfer an old Connection.
Configure the exact HTTPS service origin outside chat as described in the skill.

For a headless agent session, run
`"$client_root/.venv/bin/brewsorted" login --device` and keep that process
alive. Relay its exact verification URL and short code to the intended User, who
authorizes it in their own browser. The agent never asks for SSH access, a
password, access or refresh tokens, or a recovery link.

## HTTP proxy setup

For a VM that requires an HTTP proxy, configure the environment before login
and keep it available for subsequent commands:

```bash
export HTTPS_PROXY=http://proxy.example:8080
"$client_root/.venv/bin/brewsorted" login --device
```

`HTTPS_PROXY` routes HTTPS service requests through the HTTP proxy; use
`HTTP_PROXY` for loopback HTTP development or `ALL_PROXY` as a fallback.
Lowercase forms are also accepted. `NO_PROXY` lists destinations to reach
directly. Alternatively, pass the global option before each command:
`brewsorted --proxy http://proxy.example:8080 login --device`. This explicit
option overrides environment proxies and bypass rules for API and OAuth
requests, including refresh and signing keys. Proxy settings are not saved in
the Connection. TLS verification remains enabled; an environment with a private
CA can set `SSL_CERT_FILE` or `SSL_CERT_DIR` to its trusted certificate bundle.
Keep proxy credentials in the VM's protected environment, outside chat.

## Acceptance checks

Treat each check as different evidence:

1. `brewsorted status` proves anonymous service health and compatibility only.
2. `brewsorted context` proves the saved Connection can make an authenticated
   read for the intended User.
3. After the initial access token expires, another `context` proves the saved
   refresh grant can rotate; health alone does not prove refresh.
4. With explicit authorization, create a disposable Roastery, read it by the
   complete returned Qualified ID, update and read it again, then delete that
   exact ID. This proves write/read-back separately from authentication.

For recovery, deliberately select the production-recommended archive in the public
catalog, check its identity and SHA-256 before extraction, and reinstall into its
version-specific environment. An unavailable recommendation is a publication
incident: do not infer compatibility from version order or use a withdrawn archive.
The CLI's optional version hint is advisory, not an automatic updater. See
`https://brewsorted.com/downloads.html` for download and update steps. HTTPS and
matching hashes detect corruption but do not independently prove authenticity if
the publication origin is compromised.
