Skip to content

feat: add --type, --delay, --no-enter flags to send command#5

Merged
machado144 merged 7 commits into
mainfrom
feat/send-type-mode
Apr 3, 2026
Merged

feat: add --type, --delay, --no-enter flags to send command#5
machado144 merged 7 commits into
mainfrom
feat/send-type-mode

Conversation

@machado144

Copy link
Copy Markdown
Contributor

Summary

  • --type: sends input character by character, simulating realistic typing on a PTY session — great for asciinema recordings
  • --delay <ms>: configurable inter-character delay (default 50ms); combine with --type to control typing speed
  • --no-enter: omits the trailing newline, enabling partial input builds or prompts that read a single char (e.g. read -n1)

All three flags work on both send and send-redacted, and are fully composable.

Implementation

  • SendInput now accepts a SendOptions struct (TypeMode, TypeDelay, NoEnter, Redacted) instead of a bare bool — cleaner than adding more positional params
  • New fields (type_mode, type_delay, no_enter) added to DaemonRequest for transport over the Unix socket
  • Zero behaviour change for existing callers (all default to the old input + "\n" path)

Tests

6 new unit tests in services/process_manager_test.go:

  • TestProcessManager_TypeMode_OutputAppears — full string echoed back via cat
  • TestProcessManager_TypeMode_DelayIsRespected — measures elapsed time matches n_chars × delay
  • TestProcessManager_TypeMode_ZeroDelay — no sleep path
  • TestProcessManager_NoEnter_NoLineEcho — partial input holds read until newline sent separately
  • TestProcessManager_TypeMode_WithRedaction — type mode + redaction still masks output
  • TestProcessManager_TypeMode_NoEnter_Combined — all three options together

2 new integration tests in integration/cli_test.go:

  • TestIntegration_SendTypeMode — end-to-end via CLI flags --type --delay 5
  • TestIntegration_SendNoEnter--no-enter + separate newline send produces correct echo

Enables simulating realistic typing interactions on PTY sessions:
- --type: sends input character by character instead of all at once
- --delay <ms>: configurable delay between characters (default 50ms), ideal for asciinema recordings
- --no-enter: omits the trailing newline, useful for prompts that read one char at a time

Refactors SendInput to accept a SendOptions struct (TypeMode, TypeDelay, NoEnter, Redacted)
and adds 6 unit tests + 2 integration tests covering type mode, delay timing, no-enter,
combined usage, and redaction in type mode.
@github-actions

github-actions Bot commented Apr 3, 2026

Copy link
Copy Markdown

StructLint — All checks passed

58 rules validated against .structlint.yaml. No violations found.

View full run · Powered by StructLint

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core Changes

  • Introduced new CLI flags --type, --delay, and --no-enter for the send and send-redacted commands, allowing for character-by-character input, configurable delays, and optional trailing newlines.
  • Refactored the services.ProcessManager.SendInput method to accept a SendOptions struct, encapsulating the new input delivery parameters (type mode, delay, no-enter, and redaction).
  • Added new fields to the domain.DaemonRequest to transport these options from the client to the daemon.
  • Implemented new unit and integration tests to cover the functionality of the new send options.

Concerns

No critical concerns regarding security, performance, or logic flaws were identified. The changes are well-contained and tested.


Verdict

Approve: The changes introduce valuable new functionality, are well-implemented, and include comprehensive tests. No issues were found that would prevent merging.


Code review performed by GEMINI - gemini-2.5-flash.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core Changes

  • Introduced new CLI flags --type, --delay, and --no-enter for the send and send-redacted commands, allowing for simulated typing, configurable delays between characters, and omitting the trailing newline.
  • Refactored the services.ProcessManager.SendInput function to accept a SendOptions struct, encapsulating the new input delivery parameters (TypeMode, TypeDelay, NoEnter, Redacted).
  • Added comprehensive unit and integration tests to validate the functionality of the new input sending modes and their combinations.

Verdict

Approve: The changes introduce new features with a clean implementation, are well-tested, and do not appear to introduce any regressions or critical issues.


Code review performed by GEMINI - gemini-2.5-flash.

Adds a per-process vt10x VT100 emulator that runs alongside the existing
ring buffer. Raw PTY bytes are fed to the emulator in captureOutput so it
always reflects the current rendered screen state.

New command: yoink snapshot <id|alias> (alias: snap)
- Renders the current terminal frame as clean plain text
- Works correctly for TUI apps (htop, vim, Claude, etc.) where yoink log
  would return raw cursor-movement escape garbage
- Works on both running and finished processes (last rendered frame)
- Trims trailing whitespace per line and trailing blank rows

7 unit tests + 3 integration tests including top as a real TUI process,
the canonical proof that snapshot > log for full-screen applications.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core Changes

  • Introduced a new snapshot command (and snap alias) to render the current VT100 screen of a process as plain text, correctly handling TUI applications.
  • Enhanced the send command with new flags: --type for character-by-character input simulation, --delay to control typing speed, and --no-enter to omit the trailing newline.
  • Refactored the internal SendInput function to accept a SendOptions struct, encapsulating input delivery parameters.

Concerns

No critical concerns regarding security, performance, or logic flaws were identified. The internal API changes are handled within the scope of this pull request.


Verdict

Approve: The changes introduce valuable new features, are well-implemented, and include comprehensive unit and integration tests. No critical issues were found.


Code review performed by GEMINI - gemini-2.5-flash.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core Changes

  • Implemented new send command flags: --type for character-by-character input, --delay to control typing speed, and --no-enter to omit the trailing newline.
  • Added a new snapshot command (snap alias) to render the current VT100 screen of a process as plain text, correctly handling TUI applications.
  • Updated internal DaemonRequest and ProcessManager.SendInput to support these new options, encapsulating send parameters in a SendOptions struct.
  • Introduced new unit and integration tests to cover the functionality of the new send flags and the snapshot command.

Concerns

No critical concerns found.


Verdict

Approve: The changes introduce valuable new features, are well-implemented, and include comprehensive tests. No critical issues or regressions were identified.


Code review performed by GEMINI - gemini-2.5-flash.

Set PTY and VT emulator to 220×50 (matched) so rendered screen geometry
is consistent. Strip CSI sequences with non-digit prefix bytes (>, <, =)
before feeding to vt10x — these are kitty keyboard protocol frames that
vt10x misinterprets as DECRC (restore cursor), jumping the cursor to (0,0)
and corrupting subsequent rendering in TUI apps.

Adds regression tests for stripVTProblematic covering normal passthrough,
each problematic prefix variant, and mixed interleaving.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core Changes

  • Introduced new snapshot command (snap) to render the current VT100 screen of a process as plain text, correctly handling TUI applications by replaying escape sequences through a VT100 emulator.
  • Enhanced the send and send-redacted commands with new flags: --type for character-by-character input, --delay to control typing speed, and --no-enter to omit the trailing newline.
  • Refactored SendInput to use a SendOptions struct for cleaner parameter passing and extended the DaemonRequest with new fields for these options.

Concerns

No critical concerns found. The changes are well-implemented and thoroughly tested.


Verdict

Approve: The new features are valuable additions, and the implementation is robust, well-tested, and follows good practices.


Code review performed by GEMINI - gemini-2.5-flash.

…corruption

TUI processes (gemini, claude, htop, etc.) emit sequences like \x1b[?25l
(hide cursor) that execute in the caller's terminal when yoink log prints
them, breaking cursor visibility and display. stripANSI() removes all CSI,
OSC, and two-byte ESC sequences from log text at format time, leaving the
raw ring buffer untouched.

Adds regression tests covering hide/show cursor, color codes, OSC titles,
alternate screen, and cursor positioning sequences.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core Changes

  • Introduced new flags for the send command: --type (simulates typing character by character), --delay (sets inter-character delay for --type), and --no-enter (omits trailing newline).
  • Added a new snapshot command (with alias snap) to render the current VT100 screen of a process as plain text, correctly handling TUI applications.
  • Refactored the internal SendInput function to accept a SendOptions struct, encapsulating the new input delivery parameters.
  • Integrated a VT100 emulator (vt10x) into managedProcess to enable the snapshot functionality and added helper functions to strip ANSI escape codes for safe log and snapshot output.

Concerns

No critical concerns found. The changes introduce new features with appropriate testing and maintain backward compatibility for existing commands.


Verdict

Approve: The changes introduce valuable new features, are well-implemented, and include comprehensive tests. No critical issues were identified.


Code review performed by GEMINI - gemini-2.5-flash.

@machado144 machado144 merged commit bb7d4fa into main Apr 3, 2026
5 checks passed
@machado144 machado144 deleted the feat/send-type-mode branch April 4, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant