Skip to content

feat(cli): set terminal title to project name#988

Open
zerone0x wants to merge 1 commit intovoidzero-dev:mainfrom
zerone0x:feat/terminal-title-project-name
Open

feat(cli): set terminal title to project name#988
zerone0x wants to merge 1 commit intovoidzero-dev:mainfrom
zerone0x:feat/terminal-title-project-name

Conversation

@zerone0x
Copy link
Contributor

Summary

  • Read the project name from the nearest package.json and set it as the terminal window title using the OSC 0 escape sequence (ESC ] 0 ; <title> BEL)
  • Applies to both the global CLI (vp binary) and the local CLI entry point
  • Falls back gracefully: no-op when stdout is not a terminal, when running in CI, or when no package.json with a name field is found

Fixes #978

Test plan

  • vite_shared tests pass (31 passed, 1 ignored)
  • Run vp dev in a project directory and verify the terminal tab/window title shows the project name instead of "vp"
  • Run vp outside any project directory and verify no error occurs (graceful fallback)
  • Verify CI pipeline passes

🤖 Generated with Claude Code

Instead of showing just "vp" as the terminal window title, read the
project name from the nearest package.json and set it as the terminal
title using the OSC 0 escape sequence. This applies to both the global
CLI and the local CLI entry points.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Mar 17, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 4506b97
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69b8fb8865945300087d6af9

pub fn set_terminal_title(title: &str) {
use std::io::Write;

if !std::io::stdout().is_terminal() || std::env::var_os("CI").is_some() {
Copy link
Member

Choose a reason for hiding this comment

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

Will there be similar issues to #986? Under what conditions would title not be supported?

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.

Set terminal title

2 participants