hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.7K
active users

I have been working and using this tool called oak which runs tree-sitter queries and renders out a template based on the results.

For example, here is a file that searches for woocommers actions/filters in a file: gist.github.com/wesen/2903f63c

But these are neither fun to write, nor is it easy to control the output, nor can I match my queries to the more tree-like structure they usually require.

1/

mnl mnl mnl mnl mnl

I am thinking that the proper way to build these queries requires scripting and a proper programming language, but I do want to keep it simple to write these ad-hoc.

Do you folks have suggestions of what I could use? One thing I don't want to do is have people recompile oak when they add a new command, but I also want to make it easy to iterate on the script, so, being able to use say a JS-ide to create the command.

@mnl perhaps Trustfall?

The oxc Javascript linter is using it to write lints over source code, so I suspect it would be a good fit here too.

It's easy to make a Trustfall playground over your dataset and get all the usual nice things: syntax highlighting, schema-aware autocomplete, integrated docs, etc.

Here's an example Trustfall playground over the APIs of Rust libraries: play.predr.ag/rustdoc

play.predr.agTrustfall Query PlaygroundQuery data sources like HackerNews and Rust crates directly in your browser.

@predrag oh I should make it clearer, I was refering to a way to write proper output formatters for these kinds of queries (as well as assemble hierarchical data for the --output json renderer), inside my ecosystem (since I want to reuse it for my other tools). Or did I miss what you would imagine trustfall to do? In a way oak is a tiny subset of trustfalls functionality, my aim being more towards "lots of small reasonably easy to extend ad-hoc tools" but built upon an underlying set of libs.

@mnl ah I didn't realize it was about output formatting, my bad!

I'm also hoping Trustfall makes it possible to build lots of small reasonably easy to extend ad-hoc tools 😅

@predrag yeah we should actually grab a coffee/tea/beer to exchange some ideas. Last time we met I hadn't built anything but now I have a significant mass of stuff I built! and most certainly unconsciously at least influenced by your stuff, i'm sure: github.com/go-go-golems/

GitHubGO GO GOLEMS!GO GO GOLEMS BUILD GO GO GADGETS. GO GO GOLEMS! has 27 repositories available. Follow their code on GitHub.

@mnl I'm crazy busy for the next ~6 weeks or so (lots of tight deadlines one after the other) but let's definitely grab a coffee after that? If you wanna pick a random day in October, let's put it on the calendar now 😅