Skip to content

fix(cli): auto-detect piped stdin without --stdin flag (#13)#15

Merged
puemos merged 2 commits into
mainfrom
fix/stdin-autodetect-issue-13
Apr 11, 2026
Merged

fix(cli): auto-detect piped stdin without --stdin flag (#13)#15
puemos merged 2 commits into
mainfrom
fix/stdin-autodetect-issue-13

Conversation

@puemos
Copy link
Copy Markdown
Owner

@puemos puemos commented Apr 11, 2026

Closes #13

Problem

git diff develop | lareview --agent claude opened an empty GUI and did nothing. Stdin was only read when the explicit --stdin flag was passed.

Solution

Read stdin once up front via try_read_stdin_diff() (already non-destructive when stdin is a TTY). When no other source matches and the pipe has content, build a PendingDiff with source: "stdin". Explicit flags (--stdin, refs, --pr, --status) still take precedence.

Refactored process_cli_args out of src/main.rs into src/infra/cli/args.rs as a pure function taking piped_stdin: Option<String>, so the logic is unit-testable without real IO.

Test plan

  • cargo test --lib infra::cli::args — 4 tests, incl. issue-13 repro
  • cargo test — 205 passed, 8 suites
  • cargo clippy -- -D warnings — clean
  • Manual: git diff main | lareview --agent claude opens GUI with diff pre-loaded
  • Manual: lareview --stdin --agent claude < f.diff still works
  • Manual: lareview with no args still opens empty GUI
  • Manual: lareview main feature still opens with git-diff request

@puemos puemos merged commit 1442dbc into main Apr 11, 2026
@puemos puemos deleted the fix/stdin-autodetect-issue-13 branch April 11, 2026 13:54
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.

git diff review do nothing

1 participant