feat: Implement true non-interactive mode for -p/--prompt flag#255
Open
liciciyi wants to merge 4 commits into
Open
feat: Implement true non-interactive mode for -p/--prompt flag#255liciciyi wants to merge 4 commits into
liciciyi wants to merge 4 commits into
Conversation
- Add shouldExitAfterInitialPromptRef to track initial prompt from -p flag - Auto-exit when LLM response completes (busy becomes false) - Update help text to clarify non-interactive behavior - Fixes issue lessweb#252 where -p still entered interactive mode
Implement pure text output mode (like Claude Code's --print) when using the -p or --prompt flag. Instead of rendering the TUI, the CLI now: - Skips Ink/React UI entirely - Uses SessionManager directly to process the prompt - Outputs only the LLM response as plain text to stdout - Exits immediately after response with proper exit code Changes: - Add runNonInteractiveMode() function in cli.tsx - Import SessionManager and related types from core - Detect -p flag early and route to non-interactive mode - Handle errors gracefully with stderr output and non-zero exit codes Verification: - All tests pass (557/558, 1 skipped) - Type checking, linting, and formatting all pass - npm link works correctly - Non-interactive mode outputs clean text without ANSI codes - Auto-exit after response confirmed - Exit code 0 on success verified
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR implements a true non-interactive mode for the
-p/--promptflag, similar to Claude Code's--printmode. Instead of rendering the TUI interface, the CLI now outputs pure text responses and exits automatically.Changes
Core Implementation (
packages/cli/src/cli.tsx)runNonInteractiveMode()function that bypasses Ink/React UI entirelySessionManagerdirectly to process prompts@vegamo/deepcode-coreBehavior
Before:
$ deepcode -p "hello" [Shows full TUI with banner, status bar, etc.] [User must manually exit]After:
Testing & Verification
All Tests Pass ✅
Build Verification ✅
Functional Testing ✅
Use Cases
This feature enables:
Related Issues
Fixes Issue #252: Make -p flag exit after response
Checklist