Metadata-Version: 2.4
Name: brewsorted-cli
Version: 0.8.6
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 CLI installation

The CLI and complete matching User skill are distributed together through
[PyPI](https://pypi.org/project/brewsorted-cli/). The public qualified target is
Linux x86-64 with Python 3.12 or 3.13; Python 3.11 remains internal compatibility
coverage. Source and coordinated service/client versions remain in the private
monorepo.

## Select the production version

Read `https://brewsorted.com/api/capabilities` as JSON, require schema version 1,
and select its explicit `recommended_client_bundle_version` (`X.Y.Z`). Never
infer compatibility from PyPI's newest version. Before installing, inspect
`https://pypi.org/pypi/brewsorted-cli/X.Y.Z/json` for that exact version. Both
`brewsorted_cli-X.Y.Z-py3-none-any.whl` and `brewsorted_cli-X.Y.Z.tar.gz` must be
present with `yanked: false`. Missing, malformed, withdrawn or unavailable
metadata/files mean installation unavailable. Exact pins can still install
yanked files, so this check is required before invoking the installer.

Website archives and catalogs are retired. Historical service versions without
PyPI packages are not backfilled; recovery to one may have no fresh public CLI
installation path. Retained private immutable release assets are unchanged.

## PyPI installation

The example below names this bundle's version. Use it only when it is the live
production recommendation and its exact PyPI release passes the checks above.
Install uv or pipx first if necessary; Python and ordinary package dependencies
are required. No private repository access is needed.

```bash
client_version=0.8.6
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 production capability recommendation selects the version;
PyPI metadata establishes whether that exact release is available and not yanked.

## Private release archives

Private immutable releases still retain their original client archives for
qualification and operator recovery evidence. They are not a public fallback.
An operator reinstall from an already verified private archive can use the
original `SHA256SUMS` before extracting it:

```bash
client_root="brewsorted-client-${client_version}"
sha256sum --check SHA256SUMS || exit 1
test ! -e "$client_root" && test ! -L "$client_root" || exit 1
tar -xzf "brewsorted-client-${client_version}.tar.gz"
python3.13 -m venv "$client_root/.venv"
"$client_root/.venv/bin/python" -m pip install "$client_root"
"$client_root/.venv/bin/brewsorted" skills install --destination "$HOME/.codex/skills/brewsorted"
```

Follow the exact historical release's retained instructions when reconstructing
an old private environment. Do not rebuild or republish historical release bytes.

## Authorize separately

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
brewsorted status
```

Use a separate credential file for each exact service origin.
`BREWSORTED_ACCESS_TOKEN` is only for an explicitly configured transient agent session.
Configure the exact HTTPS service origin outside chat as described in the skill.

For a headless agent session, run
`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
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 updates, downgrades or reinstallations, re-read the production recommendation
and check the exact PyPI release again. Deliberately replace the executable with
`uv tool install --force --python python3.12 "brewsorted-cli==$client_version"`
(or the equivalent pipx command), inspect and move the old skill directory, then
install the complete matching skill again. Do not overwrite unknown paths or
use a withdrawn release. An unavailable recommendation is a publication incident,
not permission to infer compatibility. The CLI's optional version hint is
advisory and does not prove registry availability or update automatically.
See `https://brewsorted.com/downloads.html` for current installation guidance.
