Proposal: WikiShell /TiddlyShell /TiddlyCLI – A Command Console for TiddlyWiki
Objective: Introduce a built-in command console to TiddlyWiki that allows users to perform actions, process tiddlers, and manage data efficiently via simple commands. This feature aims to empower users who are not developers and complement advanced user workflows.
Key Features (Initial Scope):
- Basic Command Set:
- Import/export tiddlers.
- Modify tiddler fields or tags directly.
- Apply filters for bulk operations.
- Syntax Simplicity:
- Commands use simple, intuitive syntax akin to PowerShell (e.g.,
export-tiddler "MyTiddler"
-path DefauldDirectory orset-tag "MyTiddler" [-important [-urgent
). - Command auto-suggestions or error handling for improved usability.
- Commands use simple, intuitive syntax akin to PowerShell (e.g.,
- Integration with Widgets:
- Leverage existing
<$action>
widgets to execute tiddler-defined tasks. - Examples:
-
run-action "ActionTiddler-4876487"
to execute actions encoded in a tiddler.
-
- Leverage existing
- Extensibility:
- Modular design to add new commands easily.
- Updates via plugin or core updates.
Long-Term Vision:
- Incorporate as a core TiddlyWiki feature or make it a powerful plugin.
- Possible integration into the Advanced Filter tab as a dedicated sub-tab.
Benefits:
- Simplifies workflows for non-developers, reducing reliance on JavaScript.
- Speeds up repetitive tasks and bulk operations for advanced users.
- Centralizes power-user tools in one accessible interface.
Example Commands:
-
Export a tiddler:
export-tiddler "MyTiddler" --json
-
Add a tag to a tiddler:
set-tag "MyTiddler" important
-
Filter for tiddlers with a specific field value and change tags:
filter-tiddlers "[field:author[John]]" | set-tag reviewed
-
Run an action tiddler:
run-action "DailySetup"
Example Proof of Concept (Basic)
Here’s an idea for implementing a small prototype of this idea as a custom plugin.
Note: Since I can’t code directly, I’ll guide you with some basic examples.
Concept:
- Use the
$tw
object in TiddlyWiki’s JavaScript environment to parse and run commands. - Define a special tiddler (e.g.,
$:/WikiShell
) to serve as the interface or console window. - Commands can be processed using existing
filter
and action widget syntax.
A Basic Approach:
-
Create a Tiddler for Commands:
Example content for
$:/WikiShell
:Enter a command below: <$edit-text tiddler="$:/temp/WikiShell/Command" tag="input"/> <$button>Run Command</$button>
-
Write a Script for Processing:
Example JavaScript (to be included in a plugin):
$tw.wikishell = { runCommand: function(command) { // Split the command into parts const parts = command.split(" "); const cmd = parts[0]; const args = parts.slice(1); if(cmd === "export-tiddler") { const tiddlerTitle = args[0]; // Simulate export logic console.log(`Exporting tiddler: ${tiddlerTitle}`); } else if(cmd === "set-tag") { const tiddlerTitle = args[0]; const tag = args[1]; // Simulate tag addition logic console.log(`Setting tag "${tag}" on tiddler "${tiddlerTitle}"`); } else { console.log("Command not recognized!"); } } };
-
Set Up a Button to Trigger the Command:
Update the$:/WikiShell
tiddler:<$button> Run Command <$action-jsrun code="return $tw.wikishell.runCommand($tw.wiki.getTiddlerText('$:/temp/WikiShell/Command'))"/> </$button>
Disclaimer:
I am not a JavaScript coder nor a core developer of TiddlyWiki. The coding aspect of this proposal was conceptualized with the assistance of Copilot AI. Although, I am a real person and have edited this carefully. I really do hope this idea resonates with the community.
Comparison with Node.js Command Line:
The proposed WikiShell would operate entirely within the TiddlyWiki environment, unlike the Node.js command line, which requires external setup and execution. This internal console would:
- Be accessible directly from the TiddlyWiki interface, eliminating the need for external tools or environments.
- Use a unique, user-friendly syntax inspired by PowerShell, DOS, and Bash, making it more approachable for non-developers.
- Focus on TiddlyWiki-specific operations, such as managing tiddlers and executing actions, without requiring JavaScript knowledge.
While Node.js is powerful for advanced workflows, WikiShell would democratize access to command-line-like functionality, empowering users of all skill levels.
To all of you: Thank you for creating such inspiration through TiddlyWiki. Thank you to the community of users, developers and contributors. I would be honored to work further with you on this idea, should you decide to explore it further. I very much welcome your feedback.