Skip to content

fix(settings): show detected CLI version instead of build-time constant#2314

Open
kantord wants to merge 2 commits into
mainfrom
fix/cli-version-reporting
Open

fix(settings): show detected CLI version instead of build-time constant#2314
kantord wants to merge 2 commits into
mainfrom
fix/cli-version-reporting

Conversation

@kantord

@kantord kantord commented Jun 12, 2026

Copy link
Copy Markdown
Member

The Settings → Version tab showed the build-time TOOLHIVE_VERSION constant, while the Settings → CLI tab showed the version detected from the actual binary. This makes both tabs use the same detected value, so they always agree and always reflect the binary that's really installed.

Also makes the v prefix optional when parsing thv version output, so builds that stamp the version without it (e.g. downstream distributions) don't show "Unknown".

  • Version tab now reads cliAlignment.getStatus().cliVersion (same source as the CLI tab); falls back to "Unknown" when detection fails
  • Removed the now-unused getToolhiveVersion preload method — the renovate-managed constant keeps its build-time role (thv download) but is no longer in the display path
  • Tests added for both changes

Fully or partially written by an AI agent.

🤖 Generated with Claude Code

The Version tab displayed the static TOOLHIVE_VERSION constant (a
renovate-managed value used to download thv at build time), which is
stale in enterprise builds that bundle a different binary. Read the
version from cliAlignment.getStatus().cliVersion instead — the same
detected value the CLI tab shows — falling back to 'Unknown' when
detection fails. Remove the now-unused getToolhiveVersion preload
method.

Also make the "v" prefix optional in parseVersionOutput, since the
enterprise thv binary prints "ToolHive 0.1.39" without it, which made
the CLI tab show "Unknown".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Version tab now shows the version detected from the bundled binary,
which prints it without the "v" prefix the build-time constant carries.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kantord kantord marked this pull request as ready for review June 12, 2026 15:16
Copilot AI review requested due to automatic review settings June 12, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the Settings → Version tab with the Settings → CLI tab by sourcing the displayed ToolHive binary version from the detected thv binary (via cliAlignment.getStatus()), instead of the build-time TOOLHIVE_VERSION constant. It also broadens CLI version parsing to accept thv version output with or without a leading v, and updates tests accordingly.

Changes:

  • Version info hook now uses cliAlignment.getStatus().cliVersion for the displayed ToolHive binary version (fallback: "Unknown").
  • Removed the preload getToolhiveVersion API (build-time constant remains for other roles like downloads).
  • Updated/added unit, component, and e2e tests; CLI detection parsing now treats v as optional.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
renderer/src/common/hooks/use-app-version.ts Switches ToolHive binary version display to come from detected CLI status.
renderer/src/common/hooks/tests/use-app-version.test.ts Adds coverage for detected CLI version + "Unknown" fallbacks.
renderer/src/common/components/settings/tabs/tests/settings-tabs.test.tsx Updates settings tabs test setup to mock cliAlignment.getStatus() instead of preload version.
renderer/src/common/components/error/tests/technical-details.test.tsx Updates error technical details test to mock CLI status for crash metadata.
preload/src/api/toolhive.ts Removes the getToolhiveVersion preload API and constant import.
main/src/cli/cli-detection.ts Makes v prefix optional when parsing thv version output.
main/src/cli/tests/cli-detection.test.ts Adds tests for parsing versions with/without v, including prereleases.
e2e-tests/settings.spec.ts Updates expectation to match detected CLI output format (no leading v).

Comment on lines 41 to +44
toolhiveVersion:
toolhiveVersion.status === 'fulfilled'
? toolhiveVersion.value
: 'N/A',
cliStatus.status === 'fulfilled'
? (cliStatus.value.cliVersion ?? 'Unknown')
: 'Unknown',
Comment on lines +18 to 22
const [version, release, cliStatus] = await Promise.allSettled([
window.electronAPI.getAppVersion(),
window.electronAPI.isOfficialReleaseBuild(),
window.electronAPI.getToolhiveVersion(),
window.electronAPI.cliAlignment.getStatus(),
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants