You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(cli): accept terminal send text from stdin or file - #41754
Scripts can send a prompt to a terminal through stdin or a text file, keeping the prompt itself out of the command's process arguments.
What Changed
Add terminal send --text - to read stdin until EOF and --text-file <path> to read a UTF-8 file. Reject combining the two sources.
Reuse the existing text/file reader with opt-in stdin handling for the inline dash. Other commands keep their existing dash behavior.
Preserve whitespace, trailing newlines and control bytes, and keep the existing Enter, interrupt, submission-wait and retry flow.
Update command help, CLI reference and bundled CLI guide. Add regressions that inspect requests received over a real local socket.
Why
Inline --text exposes the full payload through process listings. Reading input before constructing the same terminal RPC avoids putting that payload in argv and reuses the existing submission behavior.
N/A — no rendered UI changes. CLI usage before and after:
# Before: the full prompt is an argument.
orca terminal send --terminal <handle> --text "full prompt" --enter --json
# After: the prompt can stay in a file or stdin.
orca terminal send --terminal <handle> --text-file ./prompt.txt --enter --json
orca terminal send --terminal <handle> --text - --enter --json < ./prompt.txt
The compiled CLI was exercised in separate processes against a synthetic socket runtime. The received payload matched UTF-8 input containing CRLF, Escape, Ctrl+U, NUL and a trailing newline. A ps inspection while stdin awaited EOF confirmed that the stdin payload was absent from argv.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Validated on macOS with Node 24:
pnpm check:changed: all 20 selected checks passed, including CLI/Node typechecks, related unit tests, lint, formatting, changed-code quality and applicable ratchets.
pnpm build:cli and pnpm verify:bundled-skill-guides passed.
All 10 new tests fail with the original terminal-send handler; the implementation was restored byte-for-byte afterward.
Compiled CLI smoke checks covered stdin, relative/absolute file paths, raw control bytes, empty stdin with Enter, interrupt, wait/retry, conflicting sources, unreadable files, help and process-list exposure.
Only synthetic data and a local test runtime were used; no real terminal input was sent. Linux, Windows and live SSH were not exercised locally. Full platform/build coverage is left to CI.
Risk
Level: Low
--text - now consumes stdin instead of sending a literal dash; a pipe must reach EOF. Interactive TTY stdin is rejected using the existing reader policy. File/stdin contents are buffered as UTF-8, as in the existing file-input commands. Paths use Node's platform-aware path handling.
The same terminal RPC carries the resolved text, so paired runtimes, terminal submission safeguards and mobile clients need no protocol change. No persisted state or settings change. A plain revert removes the new input sources.
Review
Reviewed source selection, raw-byte preservation, source conflicts, empty input and prompt-delivery compatibility. The stdin option is enabled only for terminal send. No additional runtime round trips or rendered UI changes are introduced; the payload stays out of argv when the new sources are used. Remote and cross-platform behavior were considered in source review, with live validation limited to macOS.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
The branch was rebased onto current upstream main. There are no dependency, native-module or release-version changes.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred) — scoped checks and CLI build passed locally; CI will cover the full suite.
No actionable comments were generated in the recent review.
Walkthrough
The terminal send command accepts prompt text from a UTF-8 file or stdin, in addition to inline text. The input sources are mutually exclusive. The change documents payload handling and compatibility with send options, and adds tests for content preservation, validation errors, and input edge cases.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to b500c
This change adds file and stdin sources for terminal send input, and it reuses the existing send flow. No concrete merge-blocking defect was found. Oversized payloads are rejected by the runtime after being read, which is a minor inefficiency and not a correctness or safety risk.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(cli): accept terminal send text from stdin or file" states the main change. The PR adds orca terminal send --text - (stdin) and --text-file <path> (UTF-8 file) inputs, and the titl…
Description check
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes #40838), Visual Proof (N/A with CLI before/after examples), Testing, Risk (Level: Low, with re…
Linked Issues check
Issue #40838 requires a way to pass the terminal send payload without argv, using --text-file or --text -, with the same behavior as --text. The PR meets these requirements: - --text-file <path…
Out of Scope Changes check
All changed files connect to issue #40838: - src/cli/arguments/command-body-input.ts: adds an opt-in textDashIsStdin option. The default keeps existing dash behavior for other commands. The TTY error …
Full details: Title check
Explanation
The title "feat(cli): accept terminal send text from stdin or file" states the main change. The PR adds orca terminal send --text - (stdin) and --text-file <path> (UTF-8 file) inputs, and the title names both sources. It is short and specific, and it follows a conventional type(scope) pattern. It does not mention the mutual exclusion or the process-argument motivation, but those details are not required in a title.
Full details: Description check
Explanation
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes #40838), Visual Proof (N/A with CLI before/after examples), Testing, Risk (Level: Low, with revert guidance), AI Disclosure, the upstream boundary checkbox, Notes, and the Checklist. It explains the mechanism, the user-facing before and after, the alternatives considered, and the risks. The unchecked lint/typecheck/test/build item is explained in the checklist text, and the Review section is present. The AI Disclosure section is left blank; it applies only to non-StablyAI contributors, so this is a minor gap.
Full details: Linked Issues check
Explanation
Issue #40838 requires a way to pass the terminal send payload without argv, using --text-file <path> or --text -, with the same behavior as --text. The PR meets these requirements:
--text-file <path> reads a UTF-8 file. The terminal send handler (src/cli/terminals/terminal-send.ts) reads --text through readTextOrFileFlag, which supports this input.
--text - reads stdin until EOF. The new textDashIsStdin option in src/cli/arguments/command-body-input.ts enables this only for terminal send.
Tests in src/cli/terminals/terminal-send-input.test.ts cover stdin, file input, raw whitespace and control bytes, and the existing enter, wait-submit, retry-request, and interrupt flags. They use a real local socket runtime.
Validation rejects combining --text and --text-file. The validation message for --retry-request and --wait-submit now names --text-file.
The issue lists no other acceptance criteria. Documentation and help text are non-coding and do not affect this result. Only macOS validation was run locally. Other platforms are not verified here, and the issue does not require them.
Full details: Out of Scope Changes check
Explanation
All changed files connect to issue #40838:
src/cli/arguments/command-body-input.ts: adds an opt-in textDashIsStdin option. The default keeps existing dash behavior for other commands. The TTY error text changes from "stdin body" to "stdin payload" to match the new source.
src/cli/terminals/terminal-send.ts: wires --text-file and stdin into the existing terminal send flow.
src/cli/specs/terminal-send.ts, src/cli/discovery/flag-help-text.ts, src/cli/discovery/root-help-text-secondary.ts: document the new flag and input sources.
src/cli/skills/bundled-skill-guides.ts, skill-guides/orca-cli.md, docs/site/content/docs/cli/reference.mdx: document the new usage. These are supporting documentation for the new flags.
src/cli/terminals/terminal-send-input.test.ts: tests for the new behavior.
No unrelated behavior change was found in the summary.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 89c2a9bf-d814-4c81-9c84-840f8144dc0e
Commits
Reviewing files that changed from the base of the PR and between 70488fe and b500c3f.
Files selected for processing: 9
docs/site/content/docs/cli/reference.mdx
skill-guides/orca-cli.md
src/cli/arguments/command-body-input.ts
src/cli/discovery/flag-help-text.ts
src/cli/discovery/root-help-text-secondary.ts
src/cli/skills/bundled-skill-guides.ts
src/cli/specs/terminal-send.ts
src/cli/terminals/terminal-send-input.test.ts
src/cli/terminals/terminal-send.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Scripts can send a prompt to a terminal through stdin or a text file, keeping the prompt itself out of the command's process arguments.
What Changed
terminal send --text -to read stdin until EOF and--text-file <path>to read a UTF-8 file. Reject combining the two sources.Why
Inline
--textexposes the full payload through process listings. Reading input before constructing the same terminal RPC avoids putting that payload in argv and reuses the existing submission behavior.Linked Issue
Fixes #40838
Visual Proof
N/A — no rendered UI changes. CLI usage before and after:
The compiled CLI was exercised in separate processes against a synthetic socket runtime. The received payload matched UTF-8 input containing CRLF, Escape, Ctrl+U, NUL and a trailing newline. A
psinspection while stdin awaited EOF confirmed that the stdin payload was absent from argv.Testing
Validated on macOS with Node 24:
pnpm check:changed: all 20 selected checks passed, including CLI/Node typechecks, related unit tests, lint, formatting, changed-code quality and applicable ratchets.pnpm build:cliandpnpm verify:bundled-skill-guidespassed.Only synthetic data and a local test runtime were used; no real terminal input was sent. Linux, Windows and live SSH were not exercised locally. Full platform/build coverage is left to CI.
Risk
Level: Low
--text -now consumes stdin instead of sending a literal dash; a pipe must reach EOF. Interactive TTY stdin is rejected using the existing reader policy. File/stdin contents are buffered as UTF-8, as in the existing file-input commands. Paths use Node's platform-aware path handling.The same terminal RPC carries the resolved text, so paired runtimes, terminal submission safeguards and mobile clients need no protocol change. No persisted state or settings change. A plain revert removes the new input sources.
Review
Reviewed source selection, raw-byte preservation, source conflicts, empty input and prompt-delivery compatibility. The stdin option is enabled only for terminal send. No additional runtime round trips or rendered UI changes are introduced; the payload stays out of argv when the new sources are used. Remote and cross-platform behavior were considered in source review, with live validation limited to macOS.
Agent skill upstream boundary
Notes
The branch was rebased onto current upstream main. There are no dependency, native-module or release-version changes.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — scoped checks and CLI build passed locally; CI will cover the full suite.