Command-line tools for automating Sorty from the terminal
Sorty provides two command-line tools for automation and scripting: the sorty command for controlling the app via deeplinks, and the learnings command for managing your learning profile.
Start organizing a directory with optional persona and auto-start:
# Organize current directorysorty organize .# Organize specific foldersorty organize /Users/me/Downloads# Use a specific personasorty organize ~/Documents --persona developer# Auto-start organization without previewsorty organize ~/Downloads --auto# Combine persona and auto-startsorty organize . --persona photographer --auto
Parameters:
<path> - Directory path to organize (required)
--persona <id> - Persona ID (e.g., general, developer, photographer)
--auto - Automatically start organization without preview
Use AI to generate a custom persona from a text description:
# Generate persona for specific use casesorty persona generate "I want to organize my sci-fi ebook collection by author"# Generate work-focused personasorty persona generate "Organize client project files by date and client name"
# Check if learning is enabledlearnings status# View detailed statisticslearnings stats# Export your learning profilelearnings export > my-learnings.json# Clear all learning datalearnings clear# Pause learning without deleting datalearnings withdraw# Show app version and system infolearnings info
Set SORTY_CLI_DRY_RUN=1 to print the deeplink URL instead of opening it:
# Preview the command without executingSORTY_CLI_DRY_RUN=1 sorty organize ~/Downloads --auto# Output: sorty://organize?autostart=true&path=/Users/me/Downloads
#!/bin/bash# Organize common directories with appropriate personassorty organize ~/Documents --persona general --autosorty organize ~/Downloads --persona general --autosorty organize ~/Projects --persona developer --autosorty organize ~/Photos --persona photographer --auto
#!/bin/bash# Organize only if directory has more than 50 filesDIR="$HOME/Downloads"FILE_COUNT=$(find "$DIR" -maxdepth 1 -type f | wc -l)if [ "$FILE_COUNT" -gt 50 ]; then echo "Found $FILE_COUNT files. Starting organization..." sorty organize "$DIR" --autoelse echo "Only $FILE_COUNT files. Skipping organization."fi
Use tab completion by adding the sorty script to your shell’s completion system. The command structure is designed to be intuitive and follows common CLI patterns.
The CLI requires Sorty.app to be running or will launch it automatically. Commands are executed via the sorty:// URL scheme, which opens the app if needed.