feat: auto-disable dynamic titles in --print mode#36
Merged
Conversation
When Claude is invoked with --print/-p (single-turn, non-interactive mode), dynamic pane titles are meaningless and the monitor's OSC escapes would interleave with piped stdout. Detect these flags in claude_args after parsing and set enable_dynamic=false, skipping monitor startup, hook setup, and the startup display block. Also handles --output-format json/stream-json which are similarly non-interactive. Closes #15
There was a problem hiding this comment.
Pull request overview
This PR updates ccp to automatically disable dynamic terminal titles (and the related monitor/hook behavior) when Claude is invoked in non-interactive modes like --print/-p and --output-format json|stream-json, avoiding OSC/title escape sequences interleaving with stdout output.
Changes:
- Forward
-p/--printto Claude and scan forwarded Claude args to auto-setenable_dynamic=falsefor non-interactive invocations. - Emit an informational log when dynamic titles are auto-skipped due to
--printor--output-format json|stream-json. - Add test coverage for the new detection behavior in
tests/test-suite.sh.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bin/ccp | Adds --print/-p passthrough and auto-disables dynamic titles based on forwarded Claude args. |
| tests/test-suite.sh | Adds a test block validating --print and --output-format detection and log messaging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+1080
to
+1086
| # Normal args should NOT trigger the skip (dynamic titles still enabled info) | ||
| cli_exit=0 | ||
| cli_out="${CLI_TMP_DIR}/normal.out" | ||
| CCP_CLAUDE_CMD=/usr/bin/true CCP_STATUS_PROFILE=quiet \ | ||
| STATE_DIR="${CLI_STATE_DIR}" SESSION_FILE="${CLI_SESSION_FILE}" \ | ||
| "${BIN_CCP}" --no-dynamic "Normal task" \ | ||
| >"${cli_out}" 2>&1 || cli_exit=$? |
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
--print/-pinclaude_argsafter parsing and auto-setsenable_dynamic=false--output-format jsonand--output-format stream-json(similarly non-interactive)Test plan
--printflag detected correctly (exits 0, logs skip message)-pshort flag detected correctly--printafter--separator detected correctly--output-format jsontriggers auto-disable--output-format stream-jsontriggers auto-disable--output-format textdoes not trigger auto-disableCloses #15