refactor: extract getStdinFlags helper for Windows stdin transport#395
refactor: extract getStdinFlags helper for Windows stdin transport#395pedramamini merged 1 commit intomainfrom
Conversation
…ogic Deduplicates the Windows stdin transport flag computation from 4 call sites into a single getStdinFlags() utility. Also adds SSH session exclusion to useInputProcessing and inlineWizardConversation paths that were previously missing it (the spawner's if-else chain made this safe, but the explicit guard is clearer).
Code Review - PR #395SummaryThis is an excellent refactoring that consolidates duplicated Windows stdin transport logic into a single, well-tested utility function. The PR successfully addresses code duplication while improving consistency and maintainability. ✅ Strengths
🔍 Code Quality ObservationsGood:
Minor Notes:
🔒 Security & PerformanceSecurity: ✅ No concerns
Performance: ✅ No concerns
🧪 TestingTest Coverage: ✅ Excellent
Suggested Test Verification: npm run test -- src/__tests__/renderer/utils/spawnHelpers.test.ts
npm run lint📋 RecommendationsMust Do (Before Merge):
Nice to Have (Future):
✅ VerdictLGTM with approval pending test verification. This PR demonstrates excellent software engineering:
The refactoring is low-risk (pure consolidation) and high-value (improves maintainability and fixes edge cases). Risk Assessment: 🟢 Low
Once tests pass, this is ready to merge. Review conducted per CLAUDE.md guidelines, focusing on code quality, security, performance, and test coverage. |
Summary
getStdinFlags()utilityuseInputProcessingandinlineWizardConversationpaths (previously missing)Changes
src/renderer/utils/spawnHelpers.ts— single source of truth forsendPromptViaStdin/sendPromptViaStdinRawcomputationuseAgentExecution.ts,useInputProcessing.ts,inlineWizardConversation.ts— replaced 4 inline copies withgetStdinFlags()callssrc/__tests__/renderer/utils/spawnHelpers.test.ts— 5 tests covering all flag combinationsContext
PR #376 added stdin transport flags to the batch spawn paths in
useAgentExecution. This brought the total to 4 copies of the same 6-line computation across the renderer. This PR consolidates them and makes SSH exclusion consistent everywhere (the spawner's if-else chain already made this safe, but the explicit guard is clearer).Test plan
npm run lintpassesspawnHelpers,useAgentExecution,useInputProcessing,inlineWizardConversation)