No description
Find a file
Wesley aae437f052
All checks were successful
build / release (push) Successful in 15s
build / test (push) Successful in 23s
tui: single-column line numbers in tool_edit diff blocks
Two-column layout (OLD on the left, NEW on the right) made "-" lines
sit flush against column 0 while "+"/context lines indented to
column 4, reading as misaligned in the transcript even though
content lines aligned correctly. Flatten to a single column: every
row shows its line number in the same place — OLD for "-", NEW for
"+" and context — and the existing red/green colour + sigil carry
the old-vs-new distinction. Hunk gutter ("...") and content offset
fall out of the same column width.
2026-05-18 11:09:20 +00:00
.forgejo/workflows ci: use auto-provided github.token for forgejo-release 2026-05-17 11:42:19 +00:00
cmd/legion cli: legion set-max-turns / set-max-tokens — operator inference caps 2026-05-17 19:36:34 +00:00
internal tui: single-column line numbers in tool_edit diff blocks 2026-05-18 11:09:20 +00:00
pkg/legionapi client: auto-reconnect + history replay on attach + stream-truncated render 2026-05-17 14:16:26 +00:00
.gitignore Initial commit: legion-cli extracted from legion repo 2026-05-17 11:06:54 +00:00
go.mod tui: render KindToolEdit as Claude-Code-style numbered diff blocks 2026-05-18 08:32:42 +00:00
go.sum tui: render KindToolEdit as Claude-Code-style numbered diff blocks 2026-05-18 08:32:42 +00:00
README.md Initial commit: legion-cli extracted from legion repo 2026-05-17 11:06:54 +00:00

legion-cli

Control-plane CLI and TUI for the Legion fleet.

This repo houses:

  • cmd/legion — the legion binary (subcommands: info, ps, spawn, tell, attach, pause, resume, stop, destroy).
  • pkg/legionapi — Go client library for the Legion WSS gateway (Inbound/Outbound wire types + a Client that multiplexes RPCs and subscriptions over one WebSocket).
  • internal/tui — Bubble Tea views for the interactive dashboard + per-agent attach (transcript, timeline, brain-mesh, task board).

Build

go build -o bin/legion ./cmd/legion

Cross-compile for another OS/arch with the usual GOOS/GOARCH.

Run

export LEGION_GATEWAY=wss://gateway.example.com/api/v1/ws
export LEGION_TOKEN=...

legion ps                     # list agents
legion spawn alice --model fast
legion tell alice "summarise today's news"
legion                        # interactive TUI (no args)

Flags --gateway and --token are the explicit form; the env vars above are the recommended ergonomic.

Relationship to the daemon

The CLI is a pure WS client. It does not import any daemon-internal package — the wire protocol (Inbound / Outbound / method names) is defined in pkg/legionapi/protocol.go and must stay byte-compatible with the gateway server's copy in the legion repo's internal/gateway/protocol.go. The two move in lockstep when the protocol evolves.

Releases

Tagged releases (vX.Y.Z) build linux/amd64 and darwin/arm64 binaries via the Forgejo workflow at .forgejo/workflows/build.yml.

License

Same as the parent legion repo.