Sidequest: Announcing Leo Cub - a small text mode Leo browser in Rust

122 views
Skip to first unread message

Ville M. Vainio

unread,
Aug 11, 2026, 4:52:20 PMAug 11
to leo-editor
Sometimes I like to:

- Let AI do small mods to .leo files where leoBridge can be overkill or
- Browse Leo outline in text mode to see that everything is where it should be. I spend a lot of time in Terminal because of WSL usage.

I started yet another distraction project for this in rust: https://github.com/vivainio/leo-cub

Remains to be seen how much it can do, first target is read only support for full outlines (@file nodes etc)

Edward K. Ream

unread,
Aug 11, 2026, 7:18:38 PMAug 11
to leo-e...@googlegroups.com
On Tue, Aug 11, 2026 at 3:52 PM Ville M. Vainio <viva...@gmail.com> wrote:

I started yet another distraction project for this in rust: https://github.com/vivainio/leo-cub

OMG. Ville, you are amazing.

Edward

Edward K. Ream

unread,
Aug 12, 2026, 6:38:07 AMAug 12
to leo-editor
On Tuesday, August 11, 2026 at 6:18:38 PM UTC-5 Edward K. Ream wrote:
On Tue, Aug 11, 2026 at 3:52 PM Ville M. Vainio wrote:

I started yet another distraction project for this in rust: https://github.com/vivainio/leo-cub

OMG. Ville, you are amazing.

But where's the .leo file to organize the files in the src directory? Here's what I did:

- git clone https://github.com/vivainio/leo-cub.git into c:/repos.
- Create leo-cub.leo in c:/repos/leo-cub.
- Run this recursive-import script:

"""Recursively import all python files in a directory and clean the result."""
@tabwidth - 4  # For a better match.
g.cls()

dir_ = r'C:\Repos\leo-cub\src'  # <---- Change path to suit.

c.recursiveImport(
    dir_=dir_,
    kind= '@clean',
    recursive=True,
    safe_at_file=False,
    theTypes=['.rs',],
    verbose=True
)
if 1:
    last = c.lastTopLevel()
    last.expand()
    if last.hasChildren():
        last.firstChild().expand()
    c.redraw(last)
print('Done')

@language python


- Save the outline.

Edward

Edward K. Ream

unread,
Aug 12, 2026, 6:42:38 AMAug 12
to leo-editor
On Wednesday, August 12, 2026 at 5:38:07 AM UTC-5 Edward K. Ream wrote:

> But where's the .leo file to organize the files in the src directory?

Attached is the resulting (91K) leo-cub.leo file. It should work in the top-level leo-cub folder, wherever it is.

Edward

leo-cub.leo

Edward K. Ream

unread,
Aug 12, 2026, 6:49:59 AMAug 12
to leo-e...@googlegroups.com
On Wed, Aug 12, 2026 at 5:42 AM Edward K. Ream wrote:

You will notice that the @clean nodes for src/tui.rs and src/xml.rs have a quirp. These top-level nodes start with:

use std::{
@others

Instead, the `use std::{` line should move to the start of the nodes' first child. It's an import bug. To fix it, manually move the line and save the outline. 

Edward

Edward K. Ream

unread,
Aug 12, 2026, 6:54:29 AMAug 12
to leo-editor
On Wednesday, August 12, 2026 at 5:49:59 AM UTC-5 Edward K. Ream wrote:

You will notice that the @clean nodes for src/tui.rs and src/xml.rs have a quirp. These top-level nodes start with:

use std::{
@others

Instead, the `use std::{` line should move to the start of the nodes' first child. It's an import bug. To fix it, manually move the line and save the outline. 

It's a bit more complicated than that. I had to revert (git checkout) one file. After that, reloading leo-cub.leo round-trips correctly. Attached is the latest version.

Edward
leo-cub.leo

Edward K. Ream

unread,
Aug 12, 2026, 8:46:32 AMAug 12
to leo-editor
On Wednesday, August 12, 2026 at 5:54:29 AM UTC-5 Edward K. Ream wrote:

> It's a bit more complicated than that...Attached is the latest version.

And now leo-cub.leo is part of the leo-cub repo.

Edward

Ville M. Vainio

unread,
Aug 12, 2026, 10:07:03 AMAug 12
to leo-e...@googlegroups.com
Thank you, it's now used in integration test. Also implemented missing @clean functionality (syntax highlight in .rs files under @clean)


--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/leo-editor/1a53b8b5-b6d0-4aac-bc3a-60685ed5b8ffn%40googlegroups.com.

Ville M. Vainio

unread,
Aug 12, 2026, 11:50:30 AMAug 12
to leo-e...@googlegroups.com
Update: it's now installable from pypi with

uv tool install leo-cub

(installs "cub" command)

In case you were wondering how rust app is in pypi, it's the same mechanism ruff and ty are using, described here: https://vivainio.github.io/articles/building/packaging-rust-to-pypi

Ville M. Vainio

unread,
Aug 12, 2026, 2:52:17 PMAug 12
to leo-e...@googlegroups.com
For those keeping track, the new version can merge files back to @clean nodes using Leo's algorithm (written still in rust ofc)


Determining how much faster this is compared to Leo's own python code is left as exercise for the reader ;-).


Edward K. Ream

unread,
Aug 12, 2026, 3:05:19 PMAug 12
to leo-e...@googlegroups.com
On Wed, Aug 12, 2026 at 10:50 AM Ville M. Vainio <viva...@gmail.com> wrote:

Update: it's now installable from pypi with
uv tool install leo-cub

This worked for me:

pip install uv
uv tool install leo-cub  # On Windows, installs in  C:\Users\Dev\.local\bin

Per my (somewhat eccentric workflow), I leave the Python path unchanged.

Instead, I defined c:\scripts leo-cub.cmd as follows:  (c:\scripts is on my path):

@echo off
cd C:\Repos\leo-editor
C:\Users\Dev\.local\bin\cub.exe tui leo\core\leoPy.leo %* 

Now, typing leo-cub from a console opens leoPy.leo in leo-cub.

And typing leo-cub -h types:

c:\Scripts>leo-cub -h
Browse an outline interactively (read-only)

Usage: cub.exe tui [OPTIONS] <FILE>

Arguments:
  <FILE>

Options:
      --no-derived  Show only the hierarchy stored directly in the .leo XML
  -h, --help        Print help

HTH.

Edward

Ville M. Vainio

unread,
Aug 14, 2026, 3:49:04 PMAug 14
to leo-e...@googlegroups.com
And for the same audience, the new version added Leo-equivalent @auto support (with tree-sitter), among many other usability/ergonomy improvements. The aim is to be as good as Leo for *browsing* Leo outlines, but without rich body editing functionality (it's deferred to your external $EDITOR)


pip install --upgrade leo-cub 

or 

uv tool upgrade leo-cub, as usual!

@auto is currently supported for: Python, Rust, Markdown, C#, Go, JavaScript/JSX, and TypeScript/TSX. More can be added on request, it's mostly about linking in the treesitter lib.

image.png

jkn

unread,
Aug 15, 2026, 3:59:49 AMAug 15
to leo-editor
Just to say that I agree with other comments - this is all brilliant stuff from Ville.

I am mainly an embedded programmer, and (through no desire of my own)
somewhat stuck with older tools and workflows. It is great to be able to
see what else is out there, and perhaps to piggyback on others' coattails...

resi

unread,
Aug 15, 2026, 8:01:51 AMAug 15
to leo-editor
...this is all brilliant stuff from Ville
exactly same from my side. I was very glad to find that approach - using leo for decades yet.
I hoped that this will fill the gap I could not use leo on a android tablet and tried within termux (also very good stuff for me)
$ uv tool install leo-cub
But that unfortunately resulted in:

No solution found when resolving dependencies,
because all versions of leo-cub have no wheels with
a matching platform tag (e.g., "android_24_arm64_v8a")
and you require leo-cub, we can conclude that your
requirements are unsatisfiable (wheels only avail for
...manylinux_2_17_x86_64...macosx...win_amd64)

Ville, is there any chance to have this running on that platform (android/termux)?
I like the "uv approach" very much (pip did not work as well)
I hope there is a solution beside doing all from scratch with rust-compiler, etc
(I am not familiar w/ rust, also not with wheels and all that, sorry)
Having leo run (even if only readonly (for now?)) on my android tablet would be my dream:-)

Ville M. Vainio

unread,
Aug 15, 2026, 10:18:12 AMAug 15
to leo-e...@googlegroups.com
Version 0.2.2 now ships the wheels that should be compatible, try it out


resi

unread,
Aug 15, 2026, 10:53:26 AMAug 15
to leo-editor
Works! perfect
all the best,
Karl (very glad :-)
Reply all
Reply to author
Forward
0 new messages