{
    "tailapp": 2,
    "manifest": {
        "format": 2,
        "app_id": "folder-tidy",
        "name": "Folder Tidy",
        "version": 1,
        "schema": "tailapps/v0",
        "exported_at": 1795564594,
        "from": "gallery",
        "connections": [],
        "files": {
            "app.json": "67528d3e2a5e65df9d8cb75df5447d89274e4e4053133b254cbe558b90aa7ff5"
        },
        "signature": "kBJQ3plN+b3DR/t7wGFLGJqqVQOXNUDiPkq4Ml9VbsnbqFJAT+aJOZ8UvsVJmYWbjn1zC1+vRoAWdp0YhKFdDA==",
        "key_id": "gallery-1"
    },
    "app": {
        "schema": "tailapps/v0",
        "app": "folder-tidy",
        "name": "Folder Tidy",
        "description": "Lists a folder you choose, moves files out one at a time or all at once (a job you can stop, with a note when done), and puts a word in front of every name. Mac only. Never deletes.",
        "icon": "folder.badge.gearshape",
        "version": 1,
        "permissions": [
            "files.write:inbox",
            "files.write:done",
            "notify"
        ],
        "settings": {
            "inbox": {
                "type": "folder",
                "label": "Folder to tidy",
                "default": "~/Downloads",
                "required": true
            },
            "done": {
                "type": "folder",
                "label": "Move files to",
                "default": "~/Documents/Filed",
                "create": true,
                "required": true
            },
            "prefix": {
                "type": "text",
                "label": "Word to put in front of names",
                "default": "Filed"
            }
        },
        "state": {
            "files": {
                "type": "list",
                "default": []
            }
        },
        "actions": {
            "scan": {
                "steps": [
                    {
                        "files.list": "$settings.inbox",
                        "as": "found"
                    },
                    {
                        "set": {
                            "files": "$found"
                        }
                    }
                ]
            },
            "move_one": {
                "steps": [
                    {
                        "files.move": {
                            "file": "$args.item",
                            "to": "$settings.done"
                        }
                    },
                    {
                        "files.list": "$settings.inbox",
                        "as": "found"
                    },
                    {
                        "set": {
                            "files": "$found"
                        }
                    },
                    {
                        "toast": "Moved {$args.item.name}"
                    }
                ]
            },
            "move_all": {
                "confirm": "Move every file in the folder?",
                "job": true,
                "timeout": 1800,
                "steps": [
                    {
                        "files.list": "$settings.inbox",
                        "as": "found"
                    },
                    {
                        "each": "$found",
                        "do": [
                            {
                                "files.move": {
                                    "file": "$item",
                                    "to": "$settings.done"
                                }
                            }
                        ],
                        "max": 1000,
                        "as": "moved"
                    },
                    {
                        "files.list": "$settings.inbox",
                        "as": "left"
                    },
                    {
                        "set": {
                            "files": "$left"
                        }
                    },
                    {
                        "toast": "Moved {$moved.done} files"
                    }
                ]
            },
            "prefix_all": {
                "confirm": "Put '{$settings.prefix}' in front of every name?",
                "job": true,
                "timeout": 1800,
                "steps": [
                    {
                        "files.list": "$settings.inbox",
                        "as": "found"
                    },
                    {
                        "each": "$found",
                        "do": [
                            {
                                "files.rename": {
                                    "file": "$item",
                                    "name": "{$settings.prefix} {$item.base}"
                                }
                            }
                        ],
                        "max": 1000,
                        "as": "renamed"
                    },
                    {
                        "files.list": "$settings.inbox",
                        "as": "left"
                    },
                    {
                        "set": {
                            "files": "$left"
                        }
                    },
                    {
                        "toast": "Renamed {$renamed.done} files"
                    }
                ]
            },
            "stop_move": {
                "steps": [
                    {
                        "job.cancel": "move_all"
                    },
                    {
                        "files.list": "$settings.inbox",
                        "as": "left"
                    },
                    {
                        "set": {
                            "files": "$left"
                        }
                    }
                ]
            },
            "stop_prefix": {
                "steps": [
                    {
                        "job.cancel": "prefix_all"
                    },
                    {
                        "files.list": "$settings.inbox",
                        "as": "left"
                    },
                    {
                        "set": {
                            "files": "$left"
                        }
                    }
                ]
            }
        },
        "cards": [
            {
                "id": "main",
                "layout": {
                    "column": [
                        {
                            "list": "$files",
                            "limit": 50,
                            "empty": "Nothing in the folder. Press Scan.",
                            "swipe": {
                                "trailing": [
                                    {
                                        "label": "Move",
                                        "icon": "folder",
                                        "on": "move_one"
                                    }
                                ]
                            },
                            "item": {
                                "cell": "$item.name",
                                "subtitle": "$item.size | bytes",
                                "leading": "doc"
                            }
                        },
                        {
                            "progress": "$job.move_all.progress",
                            "label": "Moving {$job.move_all.done} of {$job.move_all.total}",
                            "when": "$running.move_all"
                        },
                        {
                            "progress": "$job.prefix_all.progress",
                            "label": "Renaming {$job.prefix_all.done} of {$job.prefix_all.total}",
                            "when": "$running.prefix_all"
                        },
                        {
                            "text": "Stopped after {$job.move_all.done} of {$job.move_all.total}.",
                            "size": "s",
                            "emphasis": "subtle",
                            "when": "$job.move_all.status | map:{cancelled:true, else:false}"
                        },
                        {
                            "row": [
                                {
                                    "button": "Stop",
                                    "on": "stop_move",
                                    "style": "secondary",
                                    "when": "$running.move_all"
                                },
                                {
                                    "button": "Stop",
                                    "on": "stop_prefix",
                                    "style": "secondary",
                                    "when": "$running.prefix_all"
                                },
                                {
                                    "button": "Scan",
                                    "on": "scan",
                                    "style": "secondary",
                                    "disabled": "$running.scan"
                                },
                                {
                                    "button": "Add prefix",
                                    "on": "prefix_all",
                                    "style": "secondary",
                                    "disabled": "$running.prefix_all"
                                },
                                {
                                    "button": "Move all",
                                    "on": "move_all",
                                    "style": "primary",
                                    "disabled": "$running.move_all"
                                }
                            ],
                            "justify": "end"
                        }
                    ],
                    "gap": "m"
                }
            }
        ],
        "views": {
            "menubar": {
                "label": "{$files | count} files",
                "label_icon": "folder"
            }
        }
    },
    "app_json": "{\n  \"schema\": \"tailapps/v0\",\n  \"app\": \"folder-tidy\",\n  \"name\": \"Folder Tidy\",\n  \"description\": \"Lists a folder you choose, moves files out one at a time or all at once (a job you can stop, with a note when done), and puts a word in front of every name. Mac only. Never deletes.\",\n  \"icon\": \"folder.badge.gearshape\",\n  \"version\": 1,\n  \"permissions\": [\"files.write:inbox\", \"files.write:done\", \"notify\"],\n  \"settings\": {\n    \"inbox\": { \"type\": \"folder\", \"label\": \"Folder to tidy\", \"default\": \"~/Downloads\", \"required\": true },\n    \"done\": { \"type\": \"folder\", \"label\": \"Move files to\", \"default\": \"~/Documents/Filed\", \"create\": true, \"required\": true },\n    \"prefix\": { \"type\": \"text\", \"label\": \"Word to put in front of names\", \"default\": \"Filed\" }\n  },\n  \"state\": {\n    \"files\": { \"type\": \"list\", \"default\": [] }\n  },\n  \"actions\": {\n    \"scan\": {\n      \"steps\": [\n        { \"files.list\": \"$settings.inbox\", \"as\": \"found\" },\n        { \"set\": { \"files\": \"$found\" } }\n      ]\n    },\n    \"move_one\": {\n      \"steps\": [\n        { \"files.move\": { \"file\": \"$args.item\", \"to\": \"$settings.done\" } },\n        { \"files.list\": \"$settings.inbox\", \"as\": \"found\" },\n        { \"set\": { \"files\": \"$found\" } },\n        { \"toast\": \"Moved {$args.item.name}\" }\n      ]\n    },\n    \"move_all\": {\n      \"confirm\": \"Move every file in the folder?\",\n      \"job\": true,\n      \"timeout\": 1800,\n      \"steps\": [\n        { \"files.list\": \"$settings.inbox\", \"as\": \"found\" },\n        { \"each\": \"$found\", \"do\": [{ \"files.move\": { \"file\": \"$item\", \"to\": \"$settings.done\" } }], \"max\": 1000, \"as\": \"moved\" },\n        { \"files.list\": \"$settings.inbox\", \"as\": \"left\" },\n        { \"set\": { \"files\": \"$left\" } },\n        { \"toast\": \"Moved {$moved.done} files\" }\n      ]\n    },\n    \"prefix_all\": {\n      \"confirm\": \"Put '{$settings.prefix}' in front of every name?\",\n      \"job\": true,\n      \"timeout\": 1800,\n      \"steps\": [\n        { \"files.list\": \"$settings.inbox\", \"as\": \"found\" },\n        { \"each\": \"$found\", \"do\": [{ \"files.rename\": { \"file\": \"$item\", \"name\": \"{$settings.prefix} {$item.base}\" } }], \"max\": 1000, \"as\": \"renamed\" },\n        { \"files.list\": \"$settings.inbox\", \"as\": \"left\" },\n        { \"set\": { \"files\": \"$left\" } },\n        { \"toast\": \"Renamed {$renamed.done} files\" }\n      ]\n    },\n    \"stop_move\": {\n      \"steps\": [\n        { \"job.cancel\": \"move_all\" },\n        { \"files.list\": \"$settings.inbox\", \"as\": \"left\" },\n        { \"set\": { \"files\": \"$left\" } }\n      ]\n    },\n    \"stop_prefix\": {\n      \"steps\": [\n        { \"job.cancel\": \"prefix_all\" },\n        { \"files.list\": \"$settings.inbox\", \"as\": \"left\" },\n        { \"set\": { \"files\": \"$left\" } }\n      ]\n    }\n  },\n  \"cards\": [\n    {\n      \"id\": \"main\",\n      \"layout\": {\n        \"column\": [\n          {\n            \"list\": \"$files\",\n            \"limit\": 50,\n            \"empty\": \"Nothing in the folder. Press Scan.\",\n            \"swipe\": {\n              \"trailing\": [\n                { \"label\": \"Move\", \"icon\": \"folder\", \"on\": \"move_one\" }\n              ]\n            },\n            \"item\": {\n              \"cell\": \"$item.name\",\n              \"subtitle\": \"$item.size | bytes\",\n              \"leading\": \"doc\"\n            }\n          },\n          {\n            \"progress\": \"$job.move_all.progress\",\n            \"label\": \"Moving {$job.move_all.done} of {$job.move_all.total}\",\n            \"when\": \"$running.move_all\"\n          },\n          {\n            \"progress\": \"$job.prefix_all.progress\",\n            \"label\": \"Renaming {$job.prefix_all.done} of {$job.prefix_all.total}\",\n            \"when\": \"$running.prefix_all\"\n          },\n          {\n            \"text\": \"Stopped after {$job.move_all.done} of {$job.move_all.total}.\",\n            \"size\": \"s\",\n            \"emphasis\": \"subtle\",\n            \"when\": \"$job.move_all.status | map:{cancelled:true, else:false}\"\n          },\n          {\n            \"row\": [\n              { \"button\": \"Stop\", \"on\": \"stop_move\", \"style\": \"secondary\", \"when\": \"$running.move_all\" },\n              { \"button\": \"Stop\", \"on\": \"stop_prefix\", \"style\": \"secondary\", \"when\": \"$running.prefix_all\" },\n              { \"button\": \"Scan\", \"on\": \"scan\", \"style\": \"secondary\", \"disabled\": \"$running.scan\" },\n              { \"button\": \"Add prefix\", \"on\": \"prefix_all\", \"style\": \"secondary\", \"disabled\": \"$running.prefix_all\" },\n              { \"button\": \"Move all\", \"on\": \"move_all\", \"style\": \"primary\", \"disabled\": \"$running.move_all\" }\n            ],\n            \"justify\": \"end\"\n          }\n        ],\n        \"gap\": \"m\"\n      }\n    }\n  ],\n  \"views\": {\n    \"menubar\": { \"label\": \"{$files | count} files\", \"label_icon\": \"folder\" }\n  }\n}\n",
    "files": []
}