TiddlyWikiPluginForQuickGitCommits

Build a system that lets me/others not get so behind in committing our TW edits. This might be especially useful if TW hosts and static site generators ever emerge.

Tech

TW side

Add a field to the tiddler-editor that lets you make a tiddler with a title (tiddler caption) and body content; the title and body content provided will be the titles and body contents of a git commit.

Bash

  1. Create an accompanying Bash script that watches the tiddler folder for tiddler files with a particular filename format, such as QGC2018: .... This script would be intended to run alongside the TW server.
  2. When the script finds files that fit the pattern, sanitize the contents in some way, then pipe the relevant fields to a git command (really two commands, git add and git commit -m "...".
  3. If (2) goes OK, delete files fitting the pattern of (1).
    1. This is to allow for you to generate a static site from TW without including the quick commit files in the static site output.

In order for the automatic deletion by Bash to work, the TW server must be restarted; TW seems to keep any file made during its session in its database unless it gets deleted through the TW interface.


I'm not sure how this would work, procedurally. Perhaps:

Create subtiddler that has metadata linking to parent tiddler. When the parent tiddler is next updated after the creation or modification of the subtiddler, assume that the subtiddler (that contains the metadata for the commit pertaining to the parent tiddler) pertains to the new state of the parent tiddler. Commit the parent tiddler using metadata from subtiddler, then delete the subtiddler if commit successful.

Assumption

  • That you're OK with editing only 1 file in a commit; maybe save multi-file commits for manual commits

Can do this using the widget here: <https://tiddlywiki.com/#ActionCreateTiddlerWidget> by modifying the example code to create titles with the parent tiddler's name + the filename pattern for this functionality, so we can find only tiddlers in the file tree that ARE commit messages, and using the text=... attributes to establish commit messages.

[This is leaning towards using some GUI for managing these that are beyond Tiddly itself, but I would like to make this all quite Tiddly-based. Let's manually add the field to tiddlers' edit panel, then worry about doing it in an installable plugin manner.]

Get the Add a new field: text shadow tiddler, for modifying the Edit tiddler template ($:/core/ui/EditTemplate & Good tiddler for reference: $:/core/ui/EditTemplate/fields)

Even keyboard events are tied up in this thing! Way cool!

Aha! We can add whatever content we want to the Edit screen by tagging tiddlers with $:/tags/EditTemplate

You're able to use actions like delete tiddler, create tiddler upon saving edits or canceling edits! Edits are stored in a temp tiddler in the meantime :)