If anyone here has wanted the option to open a local SPM folder in Xcode by double-clicking on the folder, here's a way to do that.
You can use the Mac's "bundle bit" and "LaunchServices.OpenWith" extended attributes. I don't know how many future versions of MacOS will continue to support this. These days, Apple prefers setting metadata by file-extension.
The trade-off is that to view the Package's contents in Finder, you need to right-click it and select "Show Package Contents"
Hope this information is welcome. Maybe I'm the only person who wants to work with Packages this way. I really don't know.
Method A (use if you need to script, or don't want to rename your Package folder)
There's two and a half steps you need to perform...
(Step 1) Turn on the Bundle Bit:
xattr -wx com.apple.FinderInfo 0000000000000000200000000000000000000000000000000000000000000000 /path/to/package
(Step 2) Tell LaunchServices that Xcode is the owner of the file (or "file-like folder" if you prefer)...
xattr -wx com.apple.LaunchServices.OpenWith 62706C6973743030D30102030405065776657273696F6E54706174685F101062756E646C656964656E74696669657210005F101C2F4170706C69636174696F6E732F58636F64652D626574612E6170705F1012636F6D2E6170706C652E64742E58636F6465080F171C2F31500000000000000101000000000000000700000000000000000000000000000065 /path/to/package
The half-step here is this: that "step 2" probably won't work for you, as is. That's because the long hex string is actually an encoded property list, which points to my version of Xcode. So you need to figure out what that should look like on your Mac.
(The Half-Step) Take some random file on your drive, like a text file. Then use Finder's "Get Info" window and set the file to "Open with Xcode." That will write an extended attribute to the file. Then you can examine that metadata, and revisit (Step 2) equipped with a hex blob that works for you
xattr -p com.apple.LaunchServices.OpenWith /path/to/xcode.txt
If you get lost, I have a project that uses code to do this in my GitHub. If you dig through my source, it should be easy to adapt it to your own.
Method B (use if you don't like using the CLI, or are fine your Package name ending in ".pkg")
(Step 1) Turn on the Bundle Bit:
In Finder, add the extension ".pkg" your Package folder
(Step 2) Tell LaunchServices that Xcode is the owner of the package...
Right-click on the package folder/bundle, and use Finder's "Get Info" window to set it to "Open with: Xcode."