Skip to content

feat(cli): hint when a newer CLI version is available - #102

Merged
mrchtr merged 4 commits into
mainfrom
feat/cli-update-hint
Oct 23, 2026
Merged

mrchtr merged 4 commits into
mainfrom
feat/cli-update-hint

Conversation

@mrchtr

@mrchtr mrchtr commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

What

Users had no way to learn that a newer CLI release exists. After each command, haystack-enterprise now prints a one-line upgrade hint on stderr when PyPI has a newer haystack-enterprise-sdk.

Example

Installed with uv tool install (as in the README and install.sh):

$ haystack-enterprise --version
Haystack Enterprise SDK version: 1.0.0
A new version of haystack-enterprise-sdk is available: 1.0.0 -> 1.0.2. Upgrade with: uv tool upgrade haystack-enterprise-sdk

Installed with pip into a venv:

$ haystack-enterprise --version
Haystack Enterprise SDK version: 1.0.0
A new version of haystack-enterprise-sdk is available: 1.0.0 -> 1.0.2. Upgrade with: pip install -U haystack-enterprise-sdk

How it behaves

  • PyPI is queried at most once a day (1s timeout). The result is cached in ~/.haystack-enterprise/version_check.json.
  • The hint goes to stderr, so YAML/JSON on stdout stays parseable.
  • Skipped in CI (CI=true), when stderr is not a TTY, after Ctrl-C, or with HAYSTACK_ENTERPRISE_NO_UPDATE_CHECK=1.
  • Any failure (offline, bad response, pre-release version) is silent. The hint can never break a command.
  • The upgrade command depends on the install: uv tool upgrade when running from a uv/tools/<name> environment, pip install -U otherwise.

No new dependencies; implementation is in haystack_enterprise_sdk/cli.py, documented in AGENTS.md.

Testing

  • New TestUpdateHint unit tests (respx-mocked PyPI): newer version prints the hint and is cached, same/older/pre-release prints nothing, network error is silent, CI and opt-out skip the network, upgrade command matches the install type.
  • make tests-unit, make types, make all-fix pass.
  • Checked manually against the real PyPI API.

🤖 Generated with Claude Code

https://claude.ai/code/session_019h2bsqDDfsKkLiTnaQHkuR

mrchtr and others added 2 commits October 23, 2026 10:26
Checks PyPI at most once a day (cached in ~/.haystack-enterprise/version_check.json)
and prints an upgrade hint on stderr after the command. Skipped in CI, off a TTY,
or with HAYSTACK_ENTERPRISE_NO_UPDATE_CHECK set; failures are silent.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack_enterprise_sdk
  cli.py 1373, 2194-2196
Project Total  

This report was generated by python-coverage-comment-action

# Conflicts:
#	AGENTS.md
#	tests/unit/test_cli.py
# Conflicts:
#	haystack_enterprise_sdk/cli.py
@mrchtr
mrchtr merged commit 3f9b2db into main Oct 23, 2026
8 checks passed
@mrchtr
mrchtr deleted the feat/cli-update-hint branch October 23, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants