Support bundle IDs everywhere app IDs are currently used
Bundle IDs seem to uniquely identify an app (unlike app names, but like app IDs).
mas commands should accept bundle IDs anywhere app IDs are currently accepted (command-line arguments, Brewfile).
Bundle IDs are more descriptive of apps than app IDs, so if a user copies & pastes the wrong bundle ID, or makes a typo in one, it's much more obvious.
The App Store lookup web endpoint (https://itunes.apple.com/lookup) supports using bundleId instead of id, and the apps listed in CKSoftwareMap.shared() can be looked up via bundle ID instead of via app ID, so there shouldn't really be any problems supporting bundle IDs.
If everyone agrees that bundle IDs should be allowed to be used as much as possible, I can investigate all the code to ensure there are no places where app IDs are much better or the only workable option (neither should be the case).
Should we also switch to displaying bundle IDs instead of app IDs in output?
This would be implemented by changing all current app ID command-line arguments from being read as integers to being read as Strings. If the String can be parsed as a UInt64, it will be considered an app ID. Otherwise, it will be considered a bundle ID. I assume that no bundle IDs are unsigned integers, so there shouldn't be any naming collisions. Any optional arguments would have their default value set to an empty string as a marker.
For some reason, mas upgrade can accept either app IDs or app names (it's the only command that accepts both). Since app IDs aren't guaranteed to be unique, it's not that great to accept them. I would propose changing text values here to also be bundle IDs. No one should need to match by app name. Moreover, we can have tab completion search through app names, bundle IDs, and app IDs to complete to either bundle IDs or app IDs.
Change SoftwareMapAppLibrary.installedApp(forBundleID:) to return [SoftwareProduct].
Bundle ID support in mas could be very useful.
Ref https://developer.apple.com/documentation/bundleresources/information-property-list/cfbundleidentifier
A bundle ID uniquely identifies a single app throughout the system. The bundle ID string must contain only alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-), and periods (.). Typically, you use a reverse-DNS format for bundle ID strings. Bundle IDs are case-insensitive.
Ref https://developer.apple.com/help/app-store-connect/create-an-app-record/add-a-new-app (bundle ID modal): Same, but adds "A bundle ID string needs to be a uniform type identifier (UTI) that contains only ...."
Ref https://help.apple.com/xcode/mac/current/#/dev9b66ae7df: Same, but ends with "Bundle IDs are case-sensitive."
This means even these are unfortunately valid bundle IDs: ..., ---. The only requirement is that the bundle ID be unique.
A potential gotcha: sometimes apps get re-released under a new bundle ID (which means it is considered a new app) while keeping the old version available, and there’s no way to automatically migrate users to the new app. But this applies as well to the app IDs.
@toobuntu thanks for the info.
If a bundle ID need not include a non-digit, then I can add a --bundle-id or similar flag to indicate bundle ID instead of app ID.
That should take care of any issues. Otherwise, bundle IDs should be as good as app IDs, IIUC.
@serek8 Sorry to bother you out of the blue.
I'm a project lead on this project: mas.
I'm implementing support for bundle IDs in addition to ADAM IDs (formerly referred to by mas as app IDs, but correctly ADAM IDs/itemIdentifiers, as per Apple code).
In your post https://seredynski.com/articles/crawling-appstore from 2021, you mentioned using bundle-id in conjunction with SSPurchase & SSPurchaseRequest.
I haven't found any way to use bundle-id or any bundle ID with SSPurchase.
Do you remember anything about SSPurchase & related or replacement code? Do you have the time to discuss any of this with me?
Thanks for any help that you might be able to offer.