fix(cli): keep payload stdout pipe-safe - #165
Conversation
Route shared CLI progress to stderr so source and structured output can be safely piped into follow-up commands.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🤖 CodeAnt AI — Review Status
|
✅ Deploy Preview for adt-cli canceled.
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
MergerWaiting for CI and review to complete. Commit |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe CLI now reserves stdout for command payloads. Progress output, console diagnostics, and Pino pretty logs use stderr. Tests verify compact progress sequences do not write to stdout. ChangesCLI stream contract
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
The changes correctly implement the CLI stream contract by routing all progress output to stderr while preserving stdout for command payloads. The implementation is complete across all 5 write locations in the progress reporter, properly tested with an appropriate regression test, and documented with a clear coding convention rule. No blocking issues found.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 7 |
| Duplication | 4 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
View your CI Pipeline Execution ↗ for commit ae6856f
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/adt-cli/src/lib/utils/progress-reporter.test.ts (1)
17-25: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the other changed write paths.
This test covers compact
step()anddone()without a final message. It does not coverpersist()ordone(finalMessage), which changed inprogress-reporter.tsat Lines 80 and 96-99. Add these calls and assert their exact stderr writes.As per coding guidelines, enforce this contract with a regression test at the shared output/progress abstraction.
Suggested coverage
reporter.step('Reading source...'); reporter.done(); + reporter.persist('Persisted source'); + reporter.done('Finished'); - expect(stderr).toHaveBeenCalled(); + expect(stderr).toHaveBeenCalledWith('Reading source...'); + expect(stderr).toHaveBeenCalledWith('Persisted source\n'); + expect(stderr).toHaveBeenCalledWith('Finished\n');🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/adt-cli/src/lib/utils/progress-reporter.test.ts` around lines 17 - 25, Add coverage in the compact progress test for the changed persist() and done(finalMessage) paths on the reporter, asserting the exact stderr writes produced by each call while retaining the stdout-clean assertion. Use the existing createProgressReporter setup and verify the shared output contract without expanding scope beyond these two write paths.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/adt-cli/src/lib/utils/progress-reporter.ts`:
- Around line 80-82: Update persist() so the non-compact path with logger
configured routes progress through a Pino destination bound to stderr rather
than stdout, while preserving the existing compact behavior. Add coverage
verifying that this logger mode writes progress to stderr without mixing it into
command payload output.
---
Nitpick comments:
In `@packages/adt-cli/src/lib/utils/progress-reporter.test.ts`:
- Around line 17-25: Add coverage in the compact progress test for the changed
persist() and done(finalMessage) paths on the reporter, asserting the exact
stderr writes produced by each call while retaining the stdout-clean assertion.
Use the existing createProgressReporter setup and verify the shared output
contract without expanding scope beyond these two write paths.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b7115c21-89b7-434b-b6e7-e95a7ff76335
📒 Files selected for processing (3)
.agents/rules/development/coding-conventions.mdpackages/adt-cli/src/lib/utils/progress-reporter.test.tspackages/adt-cli/src/lib/utils/progress-reporter.ts
Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
User description
Summary
Verification
bunx nx test adt-cli --args="--run src/lib/utils/progress-reporter.test.ts"Summary by cubic
Route all CLI progress and diagnostics to stderr and keep stdout strictly for command payloads (source, JSON, XML) to make
adt-clioutputs pipe-safe.createProgressReporter, includingpersistanddone(finalMessage).consoleLoggerusesconsole.error; pretty logger setsdestination: 2).Written for commit fa4a32d. Summary will update on new commits.
CodeAnt-AI Description
Keep CLI payload output safe for piping
What Changed
Impact
✅ Safe piping of CLI payloads✅ Clean machine-readable stdout✅ Progress remains visible without corrupting output💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
Bug Fixes
Tests