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

34 views
Skip to first unread message

Ville M. Vainio

unread,
Aug 11, 2026, 4:52:20 PM (2 days ago) Aug 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 PM (2 days ago) Aug 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 AM (yesterday) Aug 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 AM (yesterday) Aug 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 AM (yesterday) Aug 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 AM (yesterday) Aug 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 AM (yesterday) Aug 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 AM (yesterday) Aug 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 AM (yesterday) Aug 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 PM (23 hours ago) Aug 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 PM (23 hours ago) Aug 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
Reply all
Reply to author
Forward
0 new messages