Skip to content

feat(tui): --sidebar-section shows a command's output in the sidebar - #4585

Draft
ALLiDoizCode wants to merge 1 commit into
docker:mainfrom
ALLiDoizCode:feat/sidebar-section
Draft

ALLiDoizCode wants to merge 1 commit into
docker:mainfrom
ALLiDoizCode:feat/sidebar-section

Conversation

@ALLiDoizCode

Copy link
Copy Markdown

What

A new run flag, --sidebar-section "Title=command", adds a section to the TUI's sidebar, below Tools, whose body is the output of a shell command.

  • The command runs when the TUI starts and again every 5 seconds, with a 5 second timeout.
  • Its output is shown as plain text: color sequences are stripped, long lines are cut to the sidebar's width, and at most 12 lines are kept.
  • A section with no output is hidden. A failing command still shows what it printed.
  • The flag is repeatable. With no flag, nothing changes.
$ docker agent run agent.yaml --sidebar-section "Services=docker compose ps --format '{{.Name}} {{.State}}'"

Why

The sidebar's sections are fixed: Session, Token Usage, Agent, Tools, Todos, Plans. A project that runs an agent beside services of its own has no place in the TUI to show their state, so the person at the keyboard asks the agent, or leaves the TUI, to learn whether they are up.

We hit this in spaceturtle, where the agent runs a node with apps behind it and the person wants to see which are running and which wait for approval. We carry this as a patch on v1.150.0, next to #4578, and would rather not.

How

  • pkg/tui/components/sidebar/command_sections.go: the section's state, its run and its rendering. It follows the git-branch watcher's shape: a sidebar-private message that the chat page already forwards to the sidebar. Init runs on every tab switch, so the refresh chain starts once per sidebar.
  • sidebar.go: the section is appended after Tools, and the cache is invalidated only when the output changes.
  • chat, tui, cmd/root: WithSidebarSections and the flag. A value that is not Title=command is an error before the TUI starts.
  • Docs: the CLI flag table and a "Custom Sidebar Sections" entry on the TUI page.

Testing

  • Unit tests: parsing the flag, showing and hiding the section, cutting long lines, bounding the output, running a real command once and not starting a second chain.
  • go test on pkg/tui/... and cmd/root, golangci-lint run on the changed packages and go run ./lint . pass locally. I did not run the whole of task test.
  • By hand: a section that prints a clock ticks every 5 seconds in the full TUI.

Open questions

  • The interval and the limits are constants. Happy to make them configurable, or to move this to user settings or the agent config if you prefer that shape.
  • The command runs with the TUI's own environment and working directory, like a hook. It is given by whoever starts docker-agent, never by the agent.
  • With several tabs, a refresh lands on the active tab's sidebar, as the git-branch watcher's does. Every tab has the same sections, so the active one is always current; a background tab catches up when it is shown.
  • The lean TUI has no sidebar and ignores the flag.

🤖 Generated with Claude Code

Projects that run an agent beside services of their own have no place in the
TUI to show them. --sidebar-section "Title=command" adds a section below
Tools whose body is the command's output, run at startup and again every 5
seconds with a 5 second timeout. The output is plain text, cut to the
sidebar's width and to 12 lines; a section with no output is hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jonathan Green <dev.jonathan.green@gmail.com>
@ALLiDoizCode
ALLiDoizCode requested a review from a team as a code owner October 13, 2026 14:56
@aheritier aheritier added area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key labels Oct 13, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push.

Commits that are not verified: 0198f65

See GitHub’s guide on signing commits for setup instructions. I’ve added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

@aheritier aheritier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition of signing your commits please remove claude code as co-author. You should give a try to Docker Agent it's pretty nice :)

@aheritier aheritier added status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key and removed status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key labels Oct 13, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push.\n\nCommits that are not verified: 0198f65\n\nSee GitHub's guide on signing commits for setup instructions. I've added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants