feat: show session name in statusline (#155)

* feat: show session name in statusline

Reads the session slug (auto-generated) and custom title (set via
/rename) from the transcript JSONL and displays it in dim text after
the project/git info on both expanded and compact layouts.

Custom title takes priority over auto-generated slug when both exist.

* test: add session name coverage and harden integration spawn

---------

Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
This commit is contained in:
myaiexp
2026-03-03 04:54:01 +02:00
committed by GitHub
parent 883b281df4
commit bdfa4454b3
7 changed files with 92 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import { render } from '../dist/render/index.js';
import { renderSessionLine } from '../dist/render/session-line.js';
import { renderProjectLine } from '../dist/render/lines/project.js';
import { renderToolsLine } from '../dist/render/tools-line.js';
import { renderAgentsLine } from '../dist/render/agents-line.js';
import { renderTodosLine } from '../dist/render/todos-line.js';
@@ -141,6 +142,22 @@ test('renderSessionLine omits project name when cwd is undefined', () => {
assert.ok(line.includes('[Opus]'));
});
test('renderSessionLine includes session name when present', () => {
const ctx = baseContext();
ctx.stdin.cwd = '/tmp/my-project';
ctx.transcript.sessionName = 'Renamed Session';
const line = renderSessionLine(ctx);
assert.ok(line.includes('Renamed Session'));
});
test('renderProjectLine includes session name when present', () => {
const ctx = baseContext();
ctx.stdin.cwd = '/tmp/my-project';
ctx.transcript.sessionName = 'Renamed Session';
const line = renderProjectLine(ctx);
assert.ok(line?.includes('Renamed Session'));
});
test('renderSessionLine displays git branch when present', () => {
const ctx = baseContext();
ctx.stdin.cwd = '/tmp/my-project';