List a shortcut's external dependencies

I quite often find myself needing to check on a shortcut’s external dependencies such as calls to other shortcuts or use of actions from 3rd party apps.

This is particularly the case when sharing or transferring shortcuts where these dependencies may not exist on the target device.

To help with this I’ve put together a shortcut that will analyse a selected set of shortcuts for these dependencies (or your whole library if you prefer, although this can take a while) and output these in a user friendly format (including simplifying the app identifiers for a number of well known apps).

I thought I’d share this here in case others find it useful.

https://www.icloud.com/shortcuts/7e316657a3a2454c9dc4cbc91a7c4330

The shortcut works by taking the XML representation of a shortcut and loading it into a dictionary for further processing. I’d like to credit @RosemaryOrchard for inspiring this approach by mentioning on a recent Automators episode that dictionaries could accept certain XML data (I’d previously only thought to use them for handling JSON).

Also worth noting that the shortcut assembles the dependency information in Markdown format, which could be used for further processing by amending the final steps.

4 Likes

This is RIDICULOUSLY useful. Thank you!

Great work. Especially like the documentation comments.
I have a long shortcut that runs itself in several places. To simplify duplicating it I’ve put the shortcut name in the first actions as a variable. That way I don’t have to find and change all the Run Shortcut actions. Your shortcut gives me a long list of lines saying “ * Shortcut > ? (name determined at runtime)”. Not surprising but just thought I’d mention it.

Thanks for the generous comments.

Regarding…

Yes, that is by design. If the Run Shortcuts action is using a variable then it’s not possible to determine which Shortcut is being run by looking at the Shortcuts XML.

I guess one improvement would be to include the name of the variable.

I’m currently looking to make some enhancements to my original Shortcut to pick up some additional types of dependencies so will look to add that in and will post a link to the update here when it’s ready.

A significant update to the original shortcut in this thread is now available at…

https://www.icloud.com/shortcuts/fe6b655f4ad643c087bcb69e1867fa28

Changes include

  • Detects additional types of dependency
    • Open App actions
    • Actions generated by user activity
    • Sirikit Donation actions
  • Provides additional info for Run Shortcut actions that use a variable
  • Includes a number of additional apps in the list of known apps
  • Has styled output that follows system light/dark mode
  • Runs several times faster thanks to the addition of a RegEx filter that removes the need to examine actions without dependencies
  • Shortcut renamed to simply “Shortcut Dependencies”

In addition the Shortcut has been re-structured into a number of self contained, independently callable functions. This approach makes it much easier to develop and test larger shortcuts like this in chunks, while still allowing them to be shared as a single entity.

4 Likes

Looks like LaunchCuts got the same idea. :slight_smile: