Hi, I was trying to find documentation on this and I may have missed it.
iCloud occasionally unsaves files in the Scriptable folder, and this results in “Script not found” or a black screen (it uses an image as background) and I would have to go in and redownload/load it in my iCloud to have it working.
I tried to remedy this by changing my filemanager to local() and setting my path as a bookmarked folder hosted locally. But it appears that my script is still hosted in iCloud and I don’t know of a way to make a new js file locally or change the location to direct to my iPhone.
Unfortunately the things you tried are only script specific but don’t change the inner workings of the app. To save your scripts locally you need to disable iCloud entirely for Scriptable in the settings app.
iCloud deletes the scripts on your iPhone (not online) because your iPhone storage is nearly full. You can delete some stuff to free some space up but I don’t know how much you would have to to get it working again.
You can also make a very small wrapper script that downloads and runs the other script. That works because iCloud doesn’t bother to remove small files (about less than 1 kB), or at least in my case it didn’t.