Skip to content

feat: auto-disable dynamic titles in --print mode#36

Merged
brianruggieri merged 3 commits into
mainfrom
feat/print-mode-detection
Mar 16, 2026
Merged

feat: auto-disable dynamic titles in --print mode#36
brianruggieri merged 3 commits into
mainfrom
feat/print-mode-detection

Conversation

@brianruggieri

Copy link
Copy Markdown
Owner

Summary

  • Detects --print / -p in claude_args after parsing and auto-sets enable_dynamic=false
  • Also detects --output-format json and --output-format stream-json (similarly non-interactive)
  • Skips monitor startup, hook setup, and startup display block when detected
  • Claude still runs normally with all args passed through
  • Logs an informational message when dynamic titles are skipped

Test plan

  • --print flag detected correctly (exits 0, logs skip message)
  • -p short flag detected correctly
  • --print after -- separator detected correctly
  • Normal args do not trigger the skip
  • --output-format json triggers auto-disable
  • --output-format stream-json triggers auto-disable
  • --output-format text does not trigger auto-disable
  • All 179 tests pass (14 new)
  • ShellCheck clean

Closes #15

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
Copilot AI review requested due to automatic review settings March 16, 2026 18:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/--print to Claude and scan forwarded Claude args to auto-set enable_dynamic=false for non-interactive invocations.
  • Emit an informational log when dynamic titles are auto-skipped due to --print or --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 thread tests/test-suite.sh Outdated
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=$?
@brianruggieri
brianruggieri merged commit 18fa476 into main Mar 16, 2026
@brianruggieri
brianruggieri deleted the feat/print-mode-detection branch March 16, 2026 18:47
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.

feat: auto-disable dynamic titles when Claude is invoked with --print

2 participants