Skip to content

fix(keepassxc): retrieve keepassxc app location. - #22073

Merged
raycastbot merged 5 commits into
raycast:mainfrom
pabroux:ext/keepassxc
Oct 14, 2025
Merged

raycastbot merged 5 commits into
raycast:mainfrom
pabroux:ext/keepassxc

Conversation

@pabroux

@pabroux pabroux commented Oct 9, 2025 •

Copy link
Copy Markdown
Contributor

Description

Hello there 👋🏻,

An update to find the KeePassXC app location using the Raycast API.

Fix #22043.

EDIT: The Raycast API doesn't provide a Windows path when using getApplications(). The current workaround is to have the Windows path hard-coded.

Tested on

  • macOS
  • Windows

Checklist

- fix: find app no matter the location.
- Initial commit
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: keepassxc Issues related to the keepassxc extension platform: macOS platform: Windows OP is author The OP of the PR is the author of the extension labels Oct 9, 2025
@raycastbot

ghost commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

Thank you for the update! 🎉

You can expect an initial review within five business days.

@pabroux

ghost commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

@Osmagtor, this update impacts Windows as well. Could you confirm it works on your side?

I'll wait your validation before proceeding.

Comment on lines +153 to +176
/**
* Find the installed KeePassXC application.
*
* @returns {Promise<void>} A promise that resolves nothing.
*
* This function uses the `getApplications` function from the `@raycast/api` library
* to get a list of all installed applications on the system. It then filters the list
* to only include applications with the name "KeePassXC". If the list is not empty,
* it sets the `keepassxcCli` class variable to the path of the found application.
* If the list is empty, it does nothing.
*/
static findApplication = async (): Promise<void> => {
const installedApplications = await getApplications();
const apps = installedApplications.filter((application) => application.name == "KeePassXC");
if (apps.length > 0) {
if (process.platform === "win32") {
const pathParts = apps[0].path.split("\\");
this.keepassxcCli = pathParts.slice(0, -1).concat("keepassxc-cli.exe").join("\\");
} else {
this.keepassxcCli = apps[0].path + "/Contents/MacOS/keepassxc-cli";
}
}
};

ghost Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here is the important code.

ghost Oct 10, 2025

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.

It fails to find the KeepassXC app on Windows. It seems like the list of apps retrieved by getApplications() does not return valid paths on Windows unlike on macOS:

This is the output on Windows:

[
  {
    name: 'KeePassXC',
    localizedName: undefined,
    path: '/Applications/8570d9f0-9729-57a6-89cc-06429aab905e',
    windowsAppId: '/Applications/8570d9f0-9729-57a6-89cc-06429aab905e'
  }
]

And this is the output on macOS:

[
  {
    bundleId: 'org.keepassxc.keepassxc',
    path: '/Applications/KeePassXC.app',
    name: 'KeePassXC'
  }
]

My guess is that getApplications() does not yet have a native implementation on Windows.

ghost Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great work. Thank you for your feedback 👍🏻. Do you know what /Applications/8570d9f0-9729-57a6-89cc-06429aab905e refers to 🤔?

Well, for Windows, I'll let the hardcoded path until the Raycast API offers a better way to retrieve the path.

ghost Oct 10, 2025

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.

I'm glad to be able to help 👍 I don't really know, but it reminds me of virtual or pseudo paths similar to those used by JavaScript and PHP in web environments. With any luck someone from the Raycast team can shed some light 😄

@pabroux pabroux changed the title Update keepassxc extension fix(keepassxc): retrieve keepassxc app location. Oct 9, 2025

ghost 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.

Greptile Overview

Summary

This PR fixes issue #22043 by dynamically discovering the KeePassXC application path on macOS using the Raycast API's getApplications() function, replacing the previously hard-coded path /Applications/KeePassXC.app/Contents/MacOS/keepassxc-cli.

Key changes:

  • Added new findApplication() async method that discovers KeePassXC location at runtime on macOS
  • Windows path remains hard-coded due to Raycast API limitation (documented in PR description)
  • The method is called before each CLI operation (checkCredentials and execKeepassxcCli)
  • Dependency updates including @raycast/api bumped to ^1.103.3

Issues identified:

  • Missing error handling when KeePassXC is not found on macOS—keepassxcCli remains undefined, causing unclear spawn errors instead of user-friendly "KeePassXC not found" message

Confidence Score: 4/5

  • This PR is mostly safe to merge but has one logical error that needs correction
  • The dynamic path discovery solves the reported issue effectively, but the implementation has a critical flaw: when KeePassXC is not found on macOS, the code silently leaves keepassxcCli undefined, which will cause cryptic errors when spawn is called. Adding proper error handling would make this production-ready.
  • extensions/keepassxc/src/utils/keepass-loader.ts - needs error handling for missing KeePassXC application

Important Files Changed

File Analysis

Filename Score Overview
extensions/keepassxc/src/utils/keepass-loader.ts 4/5 Changed from hard-coded macOS path to dynamic path discovery using Raycast API's getApplications(); Windows path remains hard-coded. Added new findApplication() method called before CLI operations.
extensions/keepassxc/CHANGELOG.md 5/5 Added version 1.7.1 changelog entry documenting the fix for KeePassXC app location retrieval on macOS.
extensions/keepassxc/package.json 5/5 Updated dependencies including @raycast/api to ^1.103.3 and run-applescript to ^7.1.0. Updated devDependencies.

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@pernielsentikaer

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

@Osmagtor could you give it another go?

@Osmagtor

ghost commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

It now works without a hitch.

ghost 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.

Looks good to me, approved 🔥

@raycastbot
raycastbot merged commit b51ba84 into raycast:main Oct 14, 2025
@pabroux
pabroux deleted the ext/keepassxc branch October 14, 2025 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: keepassxc Issues related to the keepassxc extension OP is author The OP of the PR is the author of the extension platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[KeePassXC] Not able to unblock KeePass file

4 participants