babashka

yannvahalewyn 2026-01-29T10:55:13.827999Z

@borkdude another little bug due to not having proper width calculation in prstack. JLine will probably solve this. I'm also thinking what if instead of complicated stripping logic, the library keeps around both versions, styled and unstyled, it's not that much memory and would make it a lot simpler.

borkdude 2026-01-29T10:57:55.512999Z

yes, implementing this with jline will fix it. you can try it as of today with the dev build which will help me get things into place as well for the full release :)

yannvahalewyn 2026-01-29T11:01:39.180119Z

Maybe I can make a test branch but I'd like to keep main stable. Aside of that, it's also my first open source CLI tool and I'm still figuring out how to release it to package managers etc..

yannvahalewyn 2026-01-29T11:01:57.316839Z

I'll see about a test branch later so we can try it out though πŸ‘

yannvahalewyn 2026-01-29T11:02:42.017989Z

Oh mb I realise you probably weren't asking for me to use the dev build in production πŸ˜…

borkdude 2026-01-29T11:05:06.083749Z

the new bb release is due in 2 days - 2 weeks max

πŸ™Œ 1
borkdude 2026-01-29T11:05:14.349409Z

so it's not too early to start rebuilding

yannvahalewyn 2026-01-29T11:06:22.478009Z

Cool. I'll open source bb-tui after that

yannvahalewyn 2026-01-29T11:42:43.488079Z

@borkdude I've made a branch which uses JLine (requires bb dev). See https://github.com/yannvanhalewyn/prstack/tree/test-swap-jline-needs-bb-dev You can run it from any repo, ideally where you have some branches going, and use <bb-dev> <path-to-bin/prstack>

borkdude 2026-01-29T11:44:32.249139Z

nice :)

borkdude 2026-01-29T11:44:54.473539Z

I guess you could also migrate away from gum so you don't need external stuff?

yannvahalewyn 2026-01-29T11:45:36.934149Z

Thanks πŸ™‚

yannvahalewyn 2026-01-29T11:45:39.561129Z

I'll leave it in for now, I think their UIs and spinners look great! Likely when working on the bb-tui library I'll start porting over some components

borkdude 2026-01-29T11:46:20.027169Z

sure

yannvahalewyn 2026-01-29T11:46:21.656359Z

Oh yeah forgot to mention, you need gum and gh to be available on the path

borkdude 2026-01-29T11:46:34.793009Z

yes, that's the problem I want to get rid off by adding Jline

πŸ‘Œ 1
borkdude 2026-01-29T11:46:40.064019Z

that's the whole point really ;)

yannvahalewyn 2026-01-29T11:47:00.185319Z

Did everything work on your machine?

borkdude 2026-01-29T11:47:13.906389Z

the charm.clj library is supposed to fix this problem (eventually?)

borkdude 2026-01-29T11:47:23.670759Z

> Did everything work on your machine?

borkdude 2026-01-29T11:47:27.211419Z

I think so yes

borkdude 2026-01-29T11:47:31.286199Z

I already had those installed

yannvahalewyn 2026-01-29T11:48:04.530559Z

> the charm.clj library is supposed to fix this problem (eventually?) Yeah, or any library that can provide some kind of UI. I like what they did with https://github.com/charmbracelet/lipgloss for example

yannvahalewyn 2026-01-29T11:49:35.620229Z

I'd make a similar library with a bunch of useful UI components that other libraries and applications can rely on

borkdude 2026-01-29T11:50:00.399569Z

yeah

borkdude 2026-01-29T11:50:07.858139Z

is that wat bb-tui would become?

yannvahalewyn 2026-01-29T11:51:38.518929Z

Not sure, I'm focusing on the Reagent like API of the UI, focus on re-rendering. I'll probably start by adding some UI components there, I need floats, prompts, layouts, scrollviews for PRStack. Then start extracting a library from that for apps or TUI frameworks

yannvahalewyn 2026-01-29T11:54:11.123569Z

Or keeping it in bb-tui in case the implementation get too tied up. Will need to mess around a bit

timo 2026-01-29T16:13:15.594569Z

https://github.com/TimoKramer/charm.clj/blob/main/docs/guides/styling-patterns.md A few things should be possible with charm.clj already. @yannvahalewyn

πŸ™Œ 1
borkdude 2026-01-29T16:30:45.056059Z

I hit a problem with JLine. The FFM Terminal doesn't seem to work on linux static (musl). It falls back to an ExecTerminal (which is probably a thing where it shells out all the time to accomplish ANSI stuff). That's a bit unfortunate since this is probably less performant? The debug script I ran to discover this in 🧡 (cc @timok @yannvahalewyn)

borkdude 2026-01-29T16:31:15.025039Z

echo '(import (quote [org.jline.terminal TerminalBuilder])
          (quote [org.jline.terminal.spi TerminalProvider SystemStream])
          (quote [org.jline.terminal.impl AbstractPosixTerminal])
          (quote [org.jline.terminal.impl.exec ExecTerminalProvider])
          (quote [org.jline.terminal.impl.ffm FfmTerminalProvider]))

  (println "--- FFM ---")
  (try (let [p (FfmTerminalProvider.)] (println :ffm (.isSystemStream p SystemStream/Output))) (catch Throwable e (println :ffm-failed (class e))))

  (println "--- Exec ---")
  (try (let [p (ExecTerminalProvider.)] (println :exec (.isSystemStream p SystemStream/Output))) (catch Throwable e (println :exec-failed (class e))))

  (println "--- TerminalBuilder ---")
  (try (let [t (-> (TerminalBuilder/builder) (.system true) (.build))] (println :terminal (.getClass t)) (println :pty (.getClass (.getPty ^AbstractPosixTerminal t))) (.close t)) (catch Throwable e (println :terminal-failed (class
  e))))' > /tmp/r.bb
./bb /tmp/r.bb
--- FFM ---
:ffm-failed java.lang.ExceptionInInitializerError
--- Exec ---
:exec true
--- TerminalBuilder ---
:terminal org.jline.terminal.impl.PosixSysTerminal
:pty org.jline.terminal.impl.exec.ExecPty

borkdude 2026-01-29T16:31:53.522409Z

I added these classes to bb just for this "research" problem:

org.jline.terminal.spi.TerminalProvider
          org.jline.terminal.spi.Pty
          org.jline.terminal.spi.SystemStream
          org.jline.terminal.impl.AbstractPosixTerminal
          org.jline.terminal.impl.exec.ExecTerminalProvider
          org.jline.terminal.impl.exec.ExecPty
          org.jline.terminal.impl.ffm.FfmTerminalProvider
          org.jline.terminal.impl.ffm.FfmNativePty
          

borkdude 2026-01-29T17:13:23.888849Z

The issue is that when I force to create a FFM Terminal, I get this in the static binary

Caused by: java.lang.IllegalArgumentException: Can't load library: libc.so.6
	at org.graalvm.nativeimage.foreign/com.oracle.svm.core.foreign.Util_java_lang_foreign_SymbolLookup.createNativeLibraries(Target_java_lang_foreign_SymbolLookup.java:155)
but isn't the idea of musl that the libc is part of the binary itself?

borkdude 2026-01-29T17:14:10.886669Z

@rahul080327 re: shelling out: this means that JLine falls back on another provider which just shells out to stty to replace things on the screen, which is less efficient

lispyclouds 2026-01-29T17:15:25.362079Z

It's not part of the binary, just that all the syscalls would work. This seems to be looking for the so file specifically so it fails

lispyclouds 2026-01-29T17:16:26.100849Z

Where are you running this? This may work in an env where libc is installed or with gccompat alpine

borkdude 2026-01-29T17:17:15.904509Z

This is running in bb CI

borkdude 2026-01-29T17:17:30.045909Z

but also tested on other linux machine

borkdude 2026-01-29T17:17:50.114519Z

I think a musl compiled static binary just doesn't dlopen stuff

lispyclouds 2026-01-29T17:19:16.957329Z

You would be able to load shared libs from any binary given that it can make the loading syscall, does this happen during the compile or runtime?

lispyclouds 2026-01-29T17:20:03.849729Z

Looks promising

hairfire 2026-01-29T18:12:06.287409Z

Has anyone tried creating a "Ralph Wiggum" AI orchestration loop using Babashka? I wonder if Babashka (i.e., Clojure) presents opportunities that are absent/difficult in other "shells".

hairfire 2026-01-29T19:08:44.753369Z

At work, I am trying to make a case for using Babashka instead of "make". Does it sound like a good idea to have "bb" allow multiple tasks to execute in sequence (e.g., bb task1 task2 task2)? Also, does it sound like a good idea to have "bb" do command-line completion on available tasks like "make" does?

borkdude 2026-01-29T19:30:20.088829Z

Completion: https://book.babashka.org/#_terminal_tab_completion

borkdude 2026-01-29T19:30:56.169449Z

Multiple tasks: you can either use (run 'task) or :depends to declare one task that runs multiple other tasks, or just write: bb task1 && bb task2

borkdude 2026-01-29T19:31:12.081169Z

I'm not in favor of bb task1 task2 since tasks can take command line arguments and this conflicts with it

hairfire 2026-01-29T19:32:17.161699Z

Thank you so much for Babashka, and the great docs that I should have consulted before bothering you 😞

borkdude 2026-01-29T19:33:35.265629Z

no problem, it's not always easy to find even if there are docs!

seancorfield 2026-01-29T19:50:00.725559Z

As someone relatively new to Babashka, I'll just note that :depends was the key for me, in making chains of tasks.

hairfire 2026-01-29T19:50:32.647759Z

One suggestion. In Babashka Book you might want to explain that one can remove the "-f" parameter from the "complete" command in the ".bashrc" code to ONLY see tasks

hairfire 2026-01-29T19:51:25.307569Z

Thank you for the response Sean. I didn't know about :depends until this thread

borkdude 2026-01-29T19:58:45.750659Z

Issues and PRs are welcome to the book project on Github :)

steveb8n 2026-01-29T21:43:16.543819Z

one caveat when using task dependencies is that it can be easy to lose yourself in these chains. So documentation is valuable. In fact, it should be possible to visualize the dependency tree and create easy to consume documentation from the bb.edn

hairfire 2026-01-29T21:45:51.591829Z

PR submitted

borkdude 2026-01-29T21:51:34.528649Z

merged and published!

hairfire 2026-01-29T21:51:49.132389Z

πŸ€“

steveb8n 2026-01-30T01:27:59.606589Z

@borkdude A task dependency visualizer is actually a really useful idea. I might add something like this because I already have experienced this pain in this use case. https://github.com/nextdoc/salesforce-babashka-sample/blob/master/bb.edn Although this is a simple example, my real world dependency tree is much more complex. If I do this, I can do it as a separate task and library. But I wonder if this might be something you’d prefer to have in the core CLI Library?

steveb8n 2026-01-30T01:35:29.263159Z

From some AI assisted thinking, I realized that this visualizer will not render a tree, but a DAG. So it’s non-trivial, but doable. I also realised that your new J-Line support might help, but an initial version can just be static. ASCII rendering of the DAG without any interactivity. But the new J-Line feature set could enhance it a lot once the initial version starts producing feedback from those of us that use it.

agorgl 2026-01-29T20:46:25.558879Z

How do we debug problems with babashka.deps/add-deps? It seems that add-deps downloads the provided dependency and adds it to the classpath, but when :importing a java class from it fails with Unable to resolve classname: org.freedesktop.dbus.connections.impl.DBusConnection :

#!/usr/bin/env bb
(require '[babashka.deps :as deps])
(deps/add-deps
 '{:deps {com.github.hypfvieh/dbus-java-core {:mvn/version "5.2.0"}
          com.github.hypfvieh/dbus-java-transport-native-unixsocket {:mvn/version "5.2.0"}}})

#_{:clj-kondo/ignore [:namespace-name-mismatch]}
(ns midi-ble-adv
  (:require
   [clojure.string :as str])
  (:import
   [org.freedesktop.dbus.connections.impl DBusConnection]))

(defn -main [& args]
  (println "Hello there"))

(when (= *file* (System/getProperty "babashka.file"))
  (apply -main *command-line-args*))

; vim: set ft=clojure:
obviously, the class exists in the dependency: https://github.com/hypfvieh/dbus-java/blob/dbus-java-parent-5.2.0/dbus-java-core/src/main/java/org/freedesktop/dbus/connections/impl/DBusConnection.java

borkdude 2026-01-29T21:06:38.908329Z

babashka cannot import Java classes that are not pre-compiled before hand with it, it only looks at clojure sources

agorgl 2026-01-30T06:37:51.015849Z

Ah yes it makes sense! I've used that feature before with a clojure library and I somehow thought it applied to all jvm dependencies

agorgl 2026-01-30T06:39:06.755889Z

I'll open an issue to maybe add a sentence here to indicate the above in bb book: https://book.babashka.org/#babashkadeps

πŸ‘ 1
yannvahalewyn 2026-01-29T00:59:40.719469Z

@borkdude about v-dom maybe being overkill for TUI apps, this video just happened to come out πŸ™ƒ https://youtu.be/LvW1HTSLPEk?si=eCfduIQiy1v8P8OK

borkdude 2026-01-29T08:12:43.228699Z

what's "rizz"?

borkdude 2026-01-29T08:13:09.060779Z

nvm, I'll just watch the 15 minute video :)

timo 2026-01-29T08:13:19.463499Z

What Does 'Rizz' Mean? Is It Just Flirting or a Red Flag?
"Rizz" is slang for charisma, referring to someone's skill in charming, flirting, or attracting a romantic partner. Popularized by streamer Kai Cenat and often used on TikTok, it is short for "charizzma" and indicates one's ability to "get game" or "rizz up" (seduce) someone. 
Key Details About "Rizz":

    Definition: Romantic, verbal, or flirtatious appeal.
    Usage: It acts as a noun ("He has so much rizz") or a verb ("Rizz up").
    Origin: Coined by YouTuber and Twitch streamer Kai Cenat around 2021.
    Recognition: Named the 2023 Word of the Year by the
    Oxford University Press
    .
    Variations:
        "Rizz up": To flirt with or charm someone.
        "W Rizz": Having high-level, successful charm.
        "L Rizz": Lacking charm or failing to flirt.
        "Unspoken Rizz": The ability to attract someone without saying anything. 

borkdude 2026-01-29T08:13:45.790989Z

ok, I thought it had to do with TUIs ;)

πŸ˜‚ 1
yannvahalewyn 2026-01-29T09:05:14.622389Z

Haha, just gen z stuff

borkdude 2026-01-29T09:11:18.373289Z

I watched most of the video. Great points. The snake game I did with reagami also didn't need reagami, you could just do immediate mode and it would work just fine. Which is why the port to Jline directly works also just fine without any diffing. Immediate mode FTW! https://gist.githubusercontent.com/borkdude/21f8e8996d5d20044f3f1c265ab7cc48/raw/81ff36c0f3730536c4bfc35d2a5963c398adc727/snake.clj

πŸ™Œ 1
borkdude 2026-01-29T09:12:29.256149Z

@timok: https://github.com/TimoKramer/charm.clj/pull/1 :)

πŸ’― 2
borkdude 2026-01-29T09:13:58.839149Z

I wonder why there is a ansi parser namespace that only has tests and isn't used anywhere else in charm.clj

borkdude 2026-01-29T09:18:52.329449Z

I asked claude to see if there is code in charm.render.screen that could be done with jline instead too. Here's what it said:

Duplicated functionality

  charm.render.screen has ANSI string constants:
  - cursor-hide, cursor-show, clear-screen, cursor-to, etc.

  charm.terminal has the same via capabilities:
  - hide-cursor, show-cursor, clear-screen, move-cursor

  These could potentially be consolidated.

  Screen buffer replacement with Display

  JLine's Display could replace the manual screen buffer. Here's roughly what it would look like:

  (:import [org.jline.utils Display AttributedString])

  (defn create-display
    "Create a JLine Display for efficient screen rendering."
    [^Terminal terminal]
    (doto (Display. terminal false)
      (.resize (-> terminal .getSize .getRows)
               (-> terminal .getSize .getColumns))))

  (defn render-lines!
    "Render lines to display with diff-based updates."
    [^Display display lines cursor-col cursor-row]
    (let [attributed (mapv #(AttributedString/fromAnsi %) lines)]
      (.update display attributed (+ (* cursor-row (.getColumns display)) cursor-col))))

  JLine's Display handles:
  - Differential updates (only redraws changed cells)
  - Proper cursor positioning
  - Width calculation for wide chars
  - Resize handling

  Would you like me to:
  1. Just consolidate the duplicate ANSI/cursor functions?
  2. Replace the screen buffer with Display?
  3. Both?

borkdude 2026-01-29T09:30:36.141469Z

ok, did just that. Replaced the screen buffer/diff things with JLine's display. It's all already in JLine. Also added this to bb.

borkdude 2026-01-29T09:30:39.120819Z

pushed it

timo 2026-01-29T09:30:47.630119Z

please do

timo 2026-01-29T09:31:08.067459Z

i am back at the keyboard now

borkdude 2026-01-29T09:33:17.245099Z

pushed the JLine Display class to bb master now too

borkdude 2026-01-29T09:39:39.427679Z

JLine also has stuff for styling, AttributedStyle etc. Did you design this library initially without JLine in mind?

timo 2026-01-29T09:40:19.562999Z

no, I did not have a lot of things in mind tbh... just wanted to know if this works.

borkdude 2026-01-29T09:40:19.888209Z

❯ What would be other JLine classes that are not yet in bb, that are commonly used?

⏺ Common JLine classes that are frequently used together:

  Styling (often used with AttributedString):
  - org.jline.utils.AttributedStyle - define colors, bold, underline, etc.
  - org.jline.utils.AttributedStringBuilder - build styled strings incrementally

  Line reading:
  - org.jline.reader.LineReader - the main interface for reading input with editing
  - org.jline.reader.History - command history
  - org.jline.reader.ParsedLine - parsed input result
  - org.jline.reader.EndOfFileException - thrown on Ctrl-D
  - org.jline.reader.UserInterruptException - thrown on Ctrl-C

  Tab completion:
  - org.jline.reader.Completer - interface for completers
  - org.jline.reader.Candidate - completion candidate
  - org.jline.builtins.Completers$FileNameCompleter - file completion

  Terminal utilities:
  - org.jline.terminal.Cursor - cursor position
  - org.jline.terminal.Attributes - terminal attributes (raw mode, echo, etc.)

  The most impactful additions would likely be:
  1. AttributedStyle + AttributedStringBuilder - essential for colored output
  2. LineReader - for building REPLs or interactive CLIs
  3. EndOfFileException + UserInterruptException - for proper signal handling in interactive apps

  Would you like me to check which of these are already included, or help add any of them?

timo 2026-01-29T09:40:28.622509Z

haha

timo 2026-01-29T09:40:43.981009Z

yeah, i can go through that

borkdude 2026-01-29T09:41:13.116269Z

ok, let's finish the charm.clj library first with JLine in mind and let's add classes to bb that are necessary for that

borkdude 2026-01-29T09:41:15.417099Z

good idea?

borkdude 2026-01-29T09:41:21.810129Z

after we're done, we can do a bb release

timo 2026-01-29T09:41:22.232289Z

sure

borkdude 2026-01-29T09:41:51.876189Z

ok, just let me know which classes I should add after the current PR

timo 2026-01-29T09:46:15.857909Z

I pushed your commits (with changed message) to main branch

πŸš€ 1
timo 2026-01-29T09:46:59.092799Z

you wanna go on with the AttributedStyle?

borkdude 2026-01-29T09:48:33.275749Z

sure

yannvahalewyn 2026-01-29T01:04:01.272909Z

tldr; basically the primeagen makes a full video about how it makes not sense to do v-diffing in TUI apps, you have the lines and can just render every time, it's not that many 'pixels'.

πŸ‘ 2
timo 2026-01-29T06:55:42.120239Z

yeah, and apart from that he also teaches how to rizz, what a man! I am using Arch BTW

🀘 1