mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-22 00:00:27 +00:00
feat(coding-agent): show session name in terminal title and footer (#876)
* ⏺ feat(tui): show session name in terminal title and footer - Add updateTerminalTitle() method that sets terminal title to "π - session-name - dirname" (or "π - dirname" if no name) - Update title when session name changes via /name or extension API - Display session name in footer after git branch with bullet separator * chore: update CHANGELOG
This commit is contained in:
parent
698aea34bd
commit
2354bc571e
3 changed files with 23 additions and 2 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
- Fixed `write` tool not displaying errors in the UI when execution fails ([#856](https://github.com/badlogic/pi-mono/issues/856))
|
- Fixed `write` tool not displaying errors in the UI when execution fails ([#856](https://github.com/badlogic/pi-mono/issues/856))
|
||||||
- Fixed HTML export using default theme instead of user's active theme
|
- Fixed HTML export using default theme instead of user's active theme
|
||||||
|
- Show session name in the footer and terminal / tab title
|
||||||
|
|
||||||
## [0.49.2] - 2026-01-19
|
## [0.49.2] - 2026-01-19
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,12 @@ export class FooterComponent implements Component {
|
||||||
pwd = `${pwd} (${branch})`;
|
pwd = `${pwd} (${branch})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add session name if set
|
||||||
|
const sessionName = this.session.sessionManager.getSessionName();
|
||||||
|
if (sessionName) {
|
||||||
|
pwd = `${pwd} • ${sessionName}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Truncate path if too long to fit width
|
// Truncate path if too long to fit width
|
||||||
if (pwd.length > width) {
|
if (pwd.length > width) {
|
||||||
const half = Math.floor(width / 2) - 2;
|
const half = Math.floor(width / 2) - 2;
|
||||||
|
|
|
||||||
|
|
@ -447,8 +447,7 @@ export class InteractiveMode {
|
||||||
this.isInitialized = true;
|
this.isInitialized = true;
|
||||||
|
|
||||||
// Set terminal title
|
// Set terminal title
|
||||||
const cwdBasename = path.basename(process.cwd());
|
this.updateTerminalTitle();
|
||||||
this.ui.terminal.setTitle(`pi - ${cwdBasename}`);
|
|
||||||
|
|
||||||
// Initialize extensions with TUI-based UI context
|
// Initialize extensions with TUI-based UI context
|
||||||
await this.initExtensions();
|
await this.initExtensions();
|
||||||
|
|
@ -469,6 +468,19 @@ export class InteractiveMode {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update terminal title with session name and cwd.
|
||||||
|
*/
|
||||||
|
private updateTerminalTitle(): void {
|
||||||
|
const cwdBasename = path.basename(process.cwd());
|
||||||
|
const sessionName = this.sessionManager.getSessionName();
|
||||||
|
if (sessionName) {
|
||||||
|
this.ui.terminal.setTitle(`π - ${sessionName} - ${cwdBasename}`);
|
||||||
|
} else {
|
||||||
|
this.ui.terminal.setTitle(`π - ${cwdBasename}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the interactive mode. This is the main entry point.
|
* Run the interactive mode. This is the main entry point.
|
||||||
* Initializes the UI, shows warnings, processes initial messages, and starts the interactive loop.
|
* Initializes the UI, shows warnings, processes initial messages, and starts the interactive loop.
|
||||||
|
|
@ -678,6 +690,7 @@ export class InteractiveMode {
|
||||||
},
|
},
|
||||||
setSessionName: (name) => {
|
setSessionName: (name) => {
|
||||||
this.sessionManager.appendSessionInfo(name);
|
this.sessionManager.appendSessionInfo(name);
|
||||||
|
this.updateTerminalTitle();
|
||||||
},
|
},
|
||||||
getSessionName: () => {
|
getSessionName: () => {
|
||||||
return this.sessionManager.getSessionName();
|
return this.sessionManager.getSessionName();
|
||||||
|
|
@ -3391,6 +3404,7 @@ export class InteractiveMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sessionManager.appendSessionInfo(name);
|
this.sessionManager.appendSessionInfo(name);
|
||||||
|
this.updateTerminalTitle();
|
||||||
this.chatContainer.addChild(new Spacer(1));
|
this.chatContainer.addChild(new Spacer(1));
|
||||||
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
|
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
|
||||||
this.ui.requestRender();
|
this.ui.requestRender();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue