Readline ( have you heard of/used it? )

riffing on

.Proposal: WikiShell / TiddlyCLI - A Command Console for TiddlyWiki - #4 by baiguai

wrt command line ui

any one
a) used a terminal ?
b) heard of “(gnu)readline” ?

im interested in the research/philosophical aspects of the command line
post linked above

(fwiw: less interested in (imho brain-dead) machine generated code )

it seams many technical details and historical tradeoffs
( line discipline !? )

have shaped the command line functionality of the less popular but more flexible operating systems

eg:feature’s of readline influence the address bar in browsers
and js-dev-console’s
(imho it would be relay something to have tw functionality to ‘work’ from within dev-console )

… might more insight into such history inform the ui/ux decisions of tomorrow

as someone famous once said / sung

in this great future you can’t forget your past

ref

https://www.linusakesson.net/programming/tty/index.php/

Beware, though: What you are about to see is not particularly elegant. In fact, the TTY subsystem — while quite functional from a user’s point of view — is a twisty little mess of special cases. To understand how this came to be, we have to go back in time.

Some of the TWCore internals can be invoked directly from the developer console.

Try this:

$tw.wiki.addToStory("SomeTiddler")

-e

OK, I tried that! IT worked and I got a little lesson:

$tw.wiki.addToStory() is deprecated since V5.1.23! Use the this.story.addToStory() from the story-object!

any easy way to make that distinction? …

fwiw the motivation/interest in a
usable prompt based interface
mostly stems from attempting to better understand
the connections betwixt constructs
which create the ui/gfx (mostly by attempting to alter and catastrophically braking things) =}
on some previous iteration (how time flys)

/daydreams about tmoad

…NLS is (imho) interesting to compare with tiddly wiki
perhaps some similar demo should be recreated on multiuser-wiki!! ;D

anyway …i was trying to recall when the console.ui was an extension how could i forget firebug!

i sniped that and got some

uncaught exception(s): Linked List only accepts string values, not undefined $:/boot/boot.js:2515:10
=p

which makes me thunk of this succulent snippet i foraged from the depths of [[search-company-scrape-data]] ;- )

parse?/split tid/text with filter

each line with
{{{ [all[current]get[text]splitregexp[\n]] }}}
each line with substring
{{{ [all[current]get[text]splitregexp[\n]contains-string[substring]] }}}

each char
{{{ [all[current]get[text]splitregexp[]] }}}

presumably it would not be much of a stretch to create
link url/uri whatever handler that could
display sections from “#err/$:/boot/boot.js:2515:10”

similar to
.https://archive.is/tM7Yo#selection-401.99-401.252

These names are reserved from initial registration, but to the extent they are already registered the existing registrant may renew them

^(random quote from archive of example.com , ftr)

perhaps i should get round to testing/(locating/reading the source of) the https://tiddlywiki.com/#WebServer%20API

though im surprised after a quick scan “commands”
is not included


PATH="./node_modules/.bin:$PATH"
tiddlywiki 
usage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]

Available commands:
* commands: Run commands returned from a filter

...

tiddlywiki --commands "[[help]]"
Error: Missing command: help

perhaps what is (imho) missing could be provided by creating
the above missing command … (any hints?)

idk but perhaps it would be nice coherence
if similar route’s/functions could be called from api or cli or …

at least it might simplify documentation?
( :

/aaaahhhhhhh finaly

a few concepts/observations from sections from this wiki
for some reason spring to mind … though tbh im not shore how much relevance any of it may or may not have …
in this or that
.context
=0

sounds like …

.Frustrations of Wikitext from a Software Dev - #10 by GameDungeon

:trumpet:

presumably the same ones that can be invoked directly are just as usefull in a cli context
like…

If you type tiddlywiki or tiddlywiki --help in the command line you get something similar as follows.

  • I did shorten the output lists and removed the extra new lines for readability hear in the thread.
  • Lines starting with -> is my custom the terminal command prompt
  • The same info can be found at: https://tiddlywiki.com/#Commands
[mario:~] $ 
->tiddlywiki 

usage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]

Available commands:

* build: Automatically run configured commands
* commands: Run commands returned from a filter
* editions: Lists the available editions of TiddlyWiki
* fetch: Fetch tiddlers from wiki by URL
* help: Display help for TiddlyWiki commands
* init: Initialise a new wiki folder
* listen: Provides an HTTP server interface to TiddlyWiki

<snip for readability - extra lines removed>

To get detailed help on a command:

tiddlywiki --help <command>

tiddlywiki --help init gives you this

[mario:~] $ 
->tiddlywiki --help init

Initialise an empty WikiFolder with a copy of the specified edition.

--init <edition> [<edition> ...]

For example:

tiddlywiki ./MyWikiFolder --init empty

Note:

* The wiki folder directory will be created if necessary
* The "edition" defaults to empty
* The init command will fail if the wiki folder is not empty
* The init command removes any includeWikis definitions in the edition's tiddlywiki.info file
* When multiple editions are specified, editions initialised later will overwrite any files shared with earlier editions (so, the final tiddlywiki.info file will be copied from the last edition)

* --editions returns a list of available editions

tiddlywik --help listen give you this

[mario:~] $ 
->tiddlywiki --help listen

Serves a wiki over HTTP.

The listen command uses NamedCommandParameters:

--listen [<name>=<value>]...

All parameters are optional with safe defaults, and can be specified in any order. The recognised parameters are:

* host - optional hostname to serve from (defaults to "127.0.0.1" aka "localhost")
* path-prefix - optional prefix for paths
* port - port number on which to listen; non-numeric values are interpreted as a system environment variable from which the port number is extracted (defaults to "8080")

<snip>

and so on. There is room for improvement. Eg: deprecated commands should not be listed anymore or they may be move to tiddlywiki --help legacy

@pmario thanks , though i do know --help command line option exists

i was looking to test/run filters (and understand more of the context things happen in )

tiddlywiki --commands “[all[]]”
Error: Missing command: $:/boot/boot.css

it seams tantalizingly close

even on the second comment on the last link i posted

perhaps @GameDungeon agree on this point

I would have found that quite useful.

fwiw commands ruining in a terminal on linux will have access to readline-input features

(afaik) not to be confused with node cli api of the same name
node Readline | Node.js v25.1.0 Documentation which interfaces with terminal via standard io ect from within node scripts

.Readline | Node.js v25.1.0 Documentation

tiddlywiki --help commands help
Sequentially run the command tokens returned from a filter

–commands <filter>
Examples

interesting …so i tried

tiddlywiki ./tw5.com/ --commands “[all[]]”
Error: Missing command: “A free, open source wiki revisited” by Mark Gibbs, NetworkWorld

tiddlywiki --verbose ./tw5.com/ --commands “[all[]]”
Boot log:
Startup task: load-modules
Startup task: info after: load-modules before: startup
Startup task: plugins after: load-modules before: startup
Startup task: startup after: load-modules
Startup task: story after: startup
Startup task: commands platforms: node after: story
Executing command: commands [all[]]
Error: Missing command: $:/boot/boot.css

what should my expectations be

i can almost list somthing with all[] but
some how it fails

how can i find out what (.tid.js) or function is running all[] ?

aka set debug=11 ( in the cli )

Yea, that documentation is completely missing and we would welcome contributions there.

Sorry about that one. It’s help says that. But honestly I do have no clue, what this one does. Most of the commands are used to build the TW distribution and those files have been built once in batch files and they are as they are at the moment. A day has only 24 hours and we need some sleep at night :wink:

PS C:\Users\Mario> tiddlywiki --help commands
Sequentially run the command tokens returned from a filter

--commands <filter>

Examples

--commands "[enlist:raw{$:/build-commands-as-text}]"

--commands "[{$:/build-commands-as-json}jsonindexes[]] :map[{$:/build-commands-as-json}jsonget<currentTiddler>]"

I see @Springer and @wiki_user wiki_user are trying perhaps to document the functions available in the browser like $tw.wiki.addToStory() which can be used in the console, in bookmarklets and even specially crafted links in a tiddler.

  • I recently ask an LLM to retrieve all such functions from the JavaScript code at tiddlywiki.com and it was very good at it, although not totally successful, with its usage examples. I did not share the results due to the rising animosity towards LLM’s (the communities loss if you ask me).

Keep in mind that within tiddlywiki you can open in story a non existent tiddler, the exact method needs checking, but this is an action way to create our missing tiddlers. I think, perhaps adding the title to the list field containing the storylist.

  • I am looking at this to create tiddler relationships that need extra data eg currency.

A hint at where I am with this;

It would be possible to create relationship tiddler titles that include both the relationship type source:type:target and include additional info to avoid the need to create the tiddler, ie the title is sufficient source:type:start:end:target where type could be spouse. It could open the title in the story where the user can either close or edit to add more information relating to that relationship, or lose it an rely on the “missing tiddler”

  • I may use :: as the delimiter for safety and search-ability.
  • but I need a way to indicate empty values eg; source::type::start::::target

now let us nerd :nerd_face: out

Interesting, can we verify TiddlyWiki qualifies as a “Meta-circular evaluator” or “Self-interpreter” as it would be a nice complement to its Non-trivial “Quine” qualities? (quine discussed previously)

  • Consider also is it a Monad? (discussed previously)
  • I imagine its not a Total functional programming - Wikipedia In particular it is impossible to define a self-interpreter in a total programming language, which I think TiddlyWiki script is.
  • But nor do I think TiddlyWiki is Turing complete - Wikipedia although perhaps part of tiddlywiki could be?

Perhaps you need to use an LLM more often (he adds knowing the comment may be controversial) :grinning_face_with_smiling_eyes:

@TW_Tones

did you type the above ??

Yes, why do you ask? You need emoji if your are trying to be ironic, which I have no idea which emoji.

if i

cd node_modules/tiddlywiki
cp  ../.bin/tiddlywiki ./tiddlywiki2

then
"""
node  --trace-exit ./tiddlywiki2
usage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]

Available commands:
"""
node can find module/boot.js

but not pass args 

node  --trace-exit ./tiddlywiki2 --command "[all[]]"
Error: Unknown command: command
(node:25269) WARNING: Exited the environment with code 1
    at exit (internal/process/per_thread.js:172:13)
    at $tw.utils.error (~/tw-test/node_modules/tiddlywiki/boot/boot.js:258:11)
    at $tw.Commander.output ($:/core/modules/startup/commands.js:24:22)
    at Commander.executeNextCommand ($:/core/modules/commander.js:89:10)
    at Commander.execute ($:/core/modules/commander.js:61:7)
    at exports.startup ($:/core/modules/startup/commands.js:31:12)
    at $tw.boot.executeNextStartupTask (~/tw-test/node_modules/tiddlywiki/boot/boot.js:2628:10)
    at $tw.boot.executeNextStartupTask (~/tw-test/node_modules/tiddlywiki/boot/boot.js:2626:21)
    at $tw.boot.executeNextStartupTask (~/tw-test/node_modules/tiddlywiki/boot/boot.js:2626:21)
    at $tw.boot.executeNextStartupTask (~/tw-test/node_modules/tiddlywiki/boot/boot.js:2626:21)


any hints , i cant contribute much but my ignorance

who wrote that code ?
i had little luck
while greping through the tw-source

finding any thing relevant , if you know the code base ?!
any hints ???

you dont see the maddening frustration
the lack of this feature brings

tiddlywiki --repl is the the way out of the macro asylum

If by “thisfeature” you mean documenting the functions, I gave a partial answer for that, otherwise I am not sure I understand this Topic.

indeed its about the command-line environment

(but also it would be nice (if not extremely beneficial) to have command line “like” interface (html) )

the necessary of browser-console interface
in some cases
."Emergency Save" - How to Save a Wiki if the UI is Broken

is nicely illustrated by pmario in the above post

as you know .Delimiting parameters with = and : can brick your wiki - #6 by Springer

and others have / will find out

things might go wrong

when you need to study

what things went wrong and how they failed

there are better environments than ones that all-ready carry to much ~state~ baggage around with them under normal operation

see also last link of first post
8|

i want to brake the wiki , to understand it better (perhaps from that perspective improve it)

but in a browser that is slow process
any you might loose *use these steps to cause N error*
its easyer to brake things (and learn from the experience) from terminal <3
=]
press return