Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

  • Understand OSC 133;D sequence requirements and placement
  • Add OSC 133;D emission at the start of the prompt function (after capturing exit code, before OSC 133;A)
  • Update documentation in README.md
  • Verify the implementation works correctly
  • Consolidate WT_SESSION/ConEmuPID conditionals in PowerShell profile
  • Add OSC 133 shell integration support to git-prompt.sh (bash)
  • Add OSC 133 shell integration support to cmd.exe PROMPT
  • Refactor cmd.exe PROMPT to avoid duplication

Latest Changes

vendor/init.bat

  • Refactored to define the base prompt once
  • Windows Terminal integration now wraps the existing prompt using %PROMPT% variable
  • Eliminates duplicate prompt definitions
  • Cleaner, more maintainable code

The prompt is now set once with:

prompt $E[1;32;49m$P$S$_$E[1;30;49mλ$S$E[0m

Then conditionally wrapped when in Windows Terminal:

if defined WT_SESSION (prompt $e]133;D$e\$e]133;A$e\$e]9;9;$P$e\%PROMPT%$e]133;B$e\)
Original prompt

@copilot Can you also implement OSC 133 ; D ; <ExitCode> ST ("FTCS_COMMAND_FINISHED") too, for Windows Terminal?

See #3041 for the history of the other implemented OSC 133 codes.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Copilot AI changed the title [WIP] Add OSC 133 D exit code implementation for Windows Terminal Add OSC 133;D support for command exit code tracking Nov 8, 2025
Copilot AI requested a review from DRSDavidSoft November 8, 2025 22:32
Copilot finished work on behalf of DRSDavidSoft November 8, 2025 22:32
@DRSDavidSoft

This comment was marked as resolved.

…and cmd.exe

Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 8, 2025

@copilot Let's move all WT_SESSION/ConEmuPID parts under one conditional statement, instead of multiple ifs to make it cleaner.

Next, can you non intrusively modify the git-prompt.sh to support...

Done in commit 4d259ba.

Changes made:

  1. Consolidated PowerShell conditionals - Merged all WT_SESSION/ConEmuPID checks into a single parent conditional block with nested checks where needed.

  2. Added bash shell integration in git-prompt.sh:

    • PROMPT_COMMAND emits OSC 133;D (with exit code) and 133;A
    • DEBUG trap emits OSC 133;C before command execution
    • PS1 includes OSC 133;B after the prompt
  3. Added cmd.exe PROMPT support in init.bat:

    • Conditionally sets enhanced PROMPT when WT_SESSION is defined
    • Includes OSC 133;D, 133;A, 133;B and OSC 9;9 for directory tracking
    • Falls back to standard prompt when not in Windows Terminal

All implementations are non-intrusive and only activate when running in Windows Terminal.

Copilot AI changed the title Add OSC 133;D support for command exit code tracking Add OSC 133 shell integration support across PowerShell, Bash, and CMD.exe Nov 8, 2025
Copilot finished work on behalf of DRSDavidSoft November 8, 2025 22:43
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Copilot AI requested a review from DRSDavidSoft November 8, 2025 22:56
Copilot finished work on behalf of DRSDavidSoft November 8, 2025 22:56
@DRSDavidSoft DRSDavidSoft marked this pull request as ready for review November 8, 2025 23:18
@DRSDavidSoft DRSDavidSoft merged commit ef46d64 into master Nov 8, 2025
4 checks passed
@DRSDavidSoft DRSDavidSoft deleted the copilot/add-osc-133-d-exit-code branch November 8, 2025 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants