Skip to content

Headless/agent invocation of TUI commands should print a brief skill-like pointer #523

Description

@mikevalstar

What do you want to change?

The TUI entrypoints enter full alt-screen TUI mode even when there is no TTY at all: (Observed on hunk 0.17.0)

$ hunk diff </dev/null 2>&1 | cat

Happy to help contribute a fix to this

Why?

Right now if an agent invokes the command if the user references it, or if you happen to try to pipe the output, the output is not super helpful.

How? (optional)

When a TUI-launching command (diff, show, stash show, patch, pager, difftool) is invoked and either

  • there's no usable TTY, or
  • a known coding-agent env var is set (CLAUDECODE, AI_AGENT, CURSOR_AGENT, CODEX_SANDBOX, OPENCODE, …) needed because some agents run commands in a real PTY (Cursor's terminal, tmux-style agent panes)

don't enter the TUI. Print a brief, skill-like response instead, enough for an agent to self-serve or someone else to know what went wrong. This should likely go to stderr.

Alternatively a simple error would make sense here as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions