// Name: Open in Curso // Description: Opens current Finder directory in Cursor IDE // Author: tayiorbeii import "@johnlindquist/kit"try { // Get the path of the currently selected item in Finder. const selectedPath = await getSelectedPath() if (!selectedPath) { notify("No file or directory selected in Finder") exit() } // Determine if the selected path is a file or directory. const stats = await stat(selectedPath) const directoryPath = stats.isDirectory() ? selectedPath : path.dirname(selectedPath) // Execute the `cursor` command with the determined directory path. await exec(`cursor "${directoryPath}"`) } catch (error: any) { // Improved error handling: Include the specific error message. notify({ title: "Error Opening in Curso", message: error?.message || "An unknown error occurred.", icon: "error", }) }