Skip to content

feat: Add getVersion() to KeymasterClient#219

Merged
macterra merged 8 commits intomainfrom
205-get-version-method
Mar 15, 2026
Merged

feat: Add getVersion() to KeymasterClient#219
macterra merged 8 commits intomainfrom
205-get-version-method

Conversation

@macterra
Copy link
Collaborator

Summary

  • Add getVersion() method to KeymasterClient returning { version, commit }
  • Fix GatekeeperClient.getVersion() return type from number to { version: string, commit: string }
  • Add get_version() to Python SDK for parity
  • Replace raw fetch(serverUrl + '/api/v1/version') in KeymasterUI with keymaster.getVersion()

Closes #205

Test plan

  • Verify server version displays correctly in Settings tab for gatekeeper-client
  • Verify server version displays correctly in Settings tab for keymaster-client
  • Verify keymaster.getVersion() works from browser console

🤖 Generated with Claude Code

macterra and others added 6 commits March 15, 2026 15:22
Add getVersion() method to KeymasterClient that returns { version,
commit } from the server's /version endpoint. Fix GatekeeperClient
getVersion() return type from number to { version, commit }. Add
get_version() to Python SDK for parity.

Replace raw fetch('/api/v1/version') in KeymasterUI with
keymaster.getVersion(), decoupling the UI from URL details.

Closes #205

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Keymaster core class (used by gatekeeper-client) didn't have
getVersion(), only KeymasterClient did. Delegate to the gatekeeper's
getVersion() with a runtime check since GatekeeperInterface doesn't
include it (local Gatekeeper has no version endpoint).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Keymaster class is a local library, not a remote client. Its
getVersion() should return its own package version, not delegate to
the gatekeeper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
createRequire is Node-only and breaks when Vite bundles keymaster for
browser clients. Use a simple version constant instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keymaster is a library used in both Node and browser — importing
package.json or using createRequire breaks Vite builds. Remove
getVersion() from the Keymaster class. The UI now checks if
keymaster.getVersion exists (KeymasterClient has it), falling back
to a direct fetch with serverUrl for the local Keymaster case.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show client and server version in the Settings tab, replacing the
removed footer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a first-class getVersion() call to the JS/TS Keymaster client and wires the web UIs (and Python SDK) to use it so version fetching is centralized in the client layer rather than ad-hoc fetch() calls.

Changes:

  • Add KeymasterClient.getVersion() returning { version, commit }
  • Fix GatekeeperClient.getVersion() typing to return { version, commit } instead of number
  • Add Python SDK get_version() and show client/server versions in both wallet UIs

Reviewed changes

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

Show a summary per file
File Description
python/keymaster_sdk/src/keymaster_sdk/keymaster_sdk.py Adds get_version() wrapper for /api/v1/version in the Python SDK.
packages/keymaster/src/keymaster-client.ts Adds getVersion() method calling ${API}/version and returning { version, commit }.
packages/gatekeeper/src/gatekeeper-client.ts Updates getVersion() return type to { version, commit } to match server response.
apps/keymaster-client/src/KeymasterUI.jsx Uses keymaster.getVersion() when available and displays client/server version in Settings.
apps/gatekeeper-client/src/KeymasterUI.jsx Same UI change as keymaster-client: prefers keymaster.getVersion() and displays versions.
Comments suppressed due to low confidence (1)

packages/gatekeeper/src/gatekeeper-client.ts:165

  • This return type change will break the existing Gatekeeper client test mocks (and any consumers) that still treat /api/v1/version as a numeric/string version. For example, tests/gatekeeper/client.test.ts currently mocks '1' and asserts toBe(1), but the Gatekeeper server actually returns { version, commit }. Update the tests/mocks (and any callers) to expect the object shape.
    async getVersion(): Promise<{ version: string; commit: string }> {
        try {
            const response = await this.axios.get(`${this.API}/version`);
            return response.data;
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

macterra and others added 2 commits March 15, 2026 17:27
Add getVersion() to KeymasterInterface type definition and export
get_version from Python SDK __init__.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Keymaster class cannot implement getVersion in browser environments
(createRequire is Node-only). The method exists on KeymasterClient and
GatekeeperClient but not on the interface.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@macterra macterra merged commit f06d89c into main Mar 15, 2026
13 checks passed
@macterra macterra deleted the 205-get-version-method branch March 15, 2026 21:37
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.

Add getVersion() method to KeymasterClient and DrawbridgeClient

2 participants