Documentation
¶
Index ¶
- func BuildTTYWatch(t *testing.T) string
- func ContainsANSIEscape(s string) bool
- func ContentLinesAtColumnZero(s string) ([]string, error)
- func DrainPTY(ptmx *os.File, timeout time.Duration) string
- func EndsWithNewline(s string) bool
- func HasAlternateScreenExitPrefix(s string) bool
- func HasBareLFNewlines(s string) bool
- func HasIndentedExitMarker(s string) bool
- func HasLeadingBlankLine(s string) bool
- func IsolatedHome(t *testing.T) string
- func ListRegistryIDs(home string) ([]string, error)
- func ListTableClientCounts(output, sessionID string) (watch, attached int, ok bool)
- func ListTableColumnsAligned(output string) bool
- func ListTableCommand(output, sessionID string) (command string, ok bool)
- func ListTableHeaderPresent(output string) bool
- func NoLeadingBlankLine(s string) error
- func NormalizeTTYOutput(b []byte) []byte
- func PostDetachOutputHasKittyGarbage(output string) bool
- func RegistryDir(home string) string
- func RegistryExists(home, sessionID string) bool
- func ScreenSnapshotTextFromScrollback(scrollback []byte, cols, rows int) (string, bool)
- func SessionReachable(home, sessionID string) bool
- func StartDetachedSession(t *testing.T, req *Request) string
- func VisibleContentLines(s string) []string
- func WatchOutputHasTTYCleanup(output string) bool
- func WriteStaleRegistry(home, sessionID, listenAddr string) error
- type RegistryEntry
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTTYWatch ¶
BuildTTYWatch builds the tty-watch binary for doctest harnesses.
func ContainsANSIEscape ¶
ContainsANSIEscape reports whether s has CSI/OSC/C0 control sequences.
func ContentLinesAtColumnZero ¶
ContentLinesAtColumnZero returns trimmed logical content lines that must start at column 0. Unlike VisibleContentLines, leading whitespace is preserved and rejected.
func EndsWithNewline ¶
EndsWithNewline reports whether s ends with a newline (host prompt must start fresh).
func HasAlternateScreenExitPrefix ¶
HasAlternateScreenExitPrefix reports the scrollback replay prefix that smears a cleared terminal with blank lines before short-command output.
func HasBareLFNewlines ¶ added in v0.0.45
HasBareLFNewlines reports whether s contains LF not preceded by CR. On interactive TTYs, bare LF advances to the next line without resetting the cursor column.
func HasIndentedExitMarker ¶
HasIndentedExitMarker reports output where [Terminal exited] is not left-aligned.
func HasLeadingBlankLine ¶
HasLeadingBlankLine reports whether s begins with a blank line before first content.
func IsolatedHome ¶
IsolatedHome returns a fresh TTY_WATCH_HOME directory for a test.
func ListRegistryIDs ¶
ListRegistryIDs scans registry dir for all *.json session ids.
func ListTableClientCounts ¶ added in v0.0.45
ListTableClientCounts parses WATCH and ATTACHED for sessionID from list table output.
func ListTableColumnsAligned ¶ added in v0.0.45
ListTableColumnsAligned reports whether header and first data row share aligned columns.
func ListTableCommand ¶ added in v0.0.45
ListTableCommand parses the COMMAND cell for sessionID from list table output.
func ListTableHeaderPresent ¶ added in v0.0.45
ListTableHeaderPresent reports whether list stdout includes the table header columns in order.
func NoLeadingBlankLine ¶
NoLeadingBlankLine reports an error when s begins with a blank line before the first visible content (e.g. relayTerminalOutput prepending "\n" before screen snapshot text).
func NormalizeTTYOutput ¶ added in v0.0.45
NormalizeTTYOutput mirrors script/tty-watch/attach.go normalizeTTYOutput for doctest regression locks on raw TTY CRLF shaping (bare LF → CRLF; standalone CR preserved).
func PostDetachOutputHasKittyGarbage ¶ added in v0.0.45
PostDetachOutputHasKittyGarbage reports visible kitty protocol fragments in post-detach PTY output (iTerm2 typing garbage after incomplete cleanup).
func RegistryDir ¶
RegistryDir returns the registry path under a TTY_WATCH_HOME.
func RegistryExists ¶
RegistryExists reports whether a session registry file exists.
func ScreenSnapshotTextFromScrollback ¶
ScreenSnapshotTextFromScrollback renders scrollback the way ptywrap screen attach does, then converts the snapshot frame to plain text the way tty-watch attach does.
func SessionReachable ¶
SessionReachable TCP-probes the registry listen address.
func StartDetachedSession ¶
StartDetachedSession starts tty-watch in a PTY, detaches with Ctrl-], returns session id.
func VisibleContentLines ¶
VisibleContentLines returns non-empty trimmed logical lines after stripping CSI sequences and normalizing CR to LF (what a user should see as content lines).
func WatchOutputHasTTYCleanup ¶ added in v0.0.45
WatchOutputHasTTYCleanup reports whether watch restored the observer terminal after grok-like mode sequences (alt-screen, kitty keyboard, mouse tracking).
func WriteStaleRegistry ¶
WriteStaleRegistry writes a registry entry pointing at an unreachable listen addr.
Types ¶
type RegistryEntry ¶
type RegistryEntry struct {
SessionID string `json:"session_id"`
ListenAddr string `json:"listen_addr"`
PID int `json:"pid"`
CreatedAt string `json:"created_at"`
Command []string `json:"command"`
Cwd string `json:"cwd,omitempty"`
}
RegistryEntry mirrors the tty-watch registry JSON shape for harness helpers.
func ReadRegistryEntry ¶
func ReadRegistryEntry(home, sessionID string) (*RegistryEntry, error)
ReadRegistryEntry loads a registry JSON entry.
type Request ¶
type Request struct {
Phase string
Bin, TTYWatchHome, SessionID, CustomSessionID string
RunCommand []string
Detach, SendCtrlC, Background bool
WatchProbe, SnapshotID, KillID string
SendID, SendMessage string
AttachID, AttachInput, AttachInputB, AttachProbe string
}
Request is the doctest harness request for tty-watch CLI tests.
type Response ¶
type Response struct {
ExitCode int
Stdout, Stderr, Combined string
SessionID string
RegistryExists bool
RegistryIDs []string
ListOutput string
SessionRunning bool
SnapshotText string
ContainsEscape bool
TimedOut bool
Elapsed time.Duration
GrokModesSeen bool
TTYCleanupOnDetach bool
PostDetachOutput string
SourceCheckOK bool
SourceCheckNote string
StdinRestoredBeforeCleanup bool
KittyPopCleanupInSrc bool
AttachStdoutWriterNormalizesRawTTY bool
InjectedBytes []byte
AltExitCode int
AltStderr string
AttachOutput string
AttachBOutput string
WatchOutput string
RunOutput string
}
Response is the doctest harness response for tty-watch CLI tests.