Defining extensible and enabling more use cases #437
Replies: 2 comments 1 reply
-
also potentially less secure, because if the other approach uses proper sandboxing the worst that could happen is that the library data is messed up. |
Beta Was this translation helpful? Give feedback.
-
Hello! I’ve caught up on the discussions here as well as in the Discord, and first wanted to give an outline of what’s been planned before this post and how I feel about the proposals in this discussion and where that can lead things. Current Planned FeaturesRelated to “Extensibility”: MacrosWhen? Maybe v9.5, but could be v9.6+
API/Interface for 3rd Party ProgramsWhen? When it’s ready, this is likely a long term change. v10?
Plugin SystemWhen? After the API. We’re talking post-v10 for this probably.
Now the RestIt seems we generally want similar things, especially when it comes to conditional operations, however my scope is admittedly much more limited than giving users free range over an entire scripting language. I believe that creating a curated set of conditions and operations will be able to cover what most users want to achieve or that I’d consider in the scope of the program, without the need for explicitly supporting a Turing-complete scripting language or requiring any sort of sandboxed environment. I would consider having arbitrary file system access, internet access, and code execution being outside the scope of the program. There is also the important distinction to make between the proposed “TagStudio Core” library/system/protocol and the “TagStudio Application” - both of which are currently intermingled but planned to be combed apart over time. Macros are tricky because they would obviously need access to an internal API, and that’s something we plan on building, however I would also consider many Macro operations being out of the scope of the “core” program. This line is not set in stone at the moment, but as the core library continues to be worked on then it will need to be solidified. Over time features could be backported to be considered “core”, but let’s not worry about that now. So, where do I see things going right now? I think that getting a good base of Macro triggers and conditions implemented, along with a GUI to create and edit them, as well an agreed upon human-readable save format/syntax would be a reasonable next step. I feel gradually working on a comprehensive number of (in-scope) conditions rather than opening up the doors to a full scripting language would be a better approach for this program specifically. “Plugins” could be the answer to more advanced operations that I probably wouldn’t want to allow for or support myself, but I feel those would be best as the last layer on this stack of features. |
Beta Was this translation helpful? Give feedback.
-
Let me start by admitting I need to become more familiar with the code base. My cursory search may have misinformed me about future intentions or current features. It is my understanding that there are currently no implementations of the goal of extensibility. Selfishly, then, I suggest an implementation that would cater to my particular use case.
Assuming the definition and goal of extensibility is to enable users to write Turing complete rules for organizing files, I suggest integrating a Lisp, Python, or other general-purpose language for this goal. For example, the use case that led me to make this discussion is automatically sorting files downloaded by a browser, such that file types like PDFs can be automatically printed and categorized based on the download source. Doing this would mean integrating into protocols like XDG or defining rules that watch file changes as a background service to trigger user input. The behavior desired by the user in these cases is likely very complex, so scripting is the only way to satisfy every use case.
Thus, the complete proposition is this: The macro system will best exist as a series of expressions connected by rules defined by Tag Studio. Rules would either be represented in the GUI, or in the code as
tagstudio.{something}
Imagine this chain of events. In Tag Studio one defines an event such as "on new file" which triggers (pseudo code)
or another example
"on new file"
"if filetype pdf"
This could allow the user to define their desired behavior with unlimited options, made even more useful if these scripts could implement new rules to expose in the GUI.
Potential downsides:
Now there is an API to break.
You are locking into a specific language, which may not be the best choice if tag studio is eventually ported.
If those downsides are too significant, I suggest allowing users to use the same GUI to make macros but instead execute files with arguments and accept input from the CLI program. This would not involve an API and would not lock in any decisions, but it is obviously less powerful for creating a complete system for interacting with files.
Beta Was this translation helpful? Give feedback.
All reactions