mirror of
https://github.com/jarrodwatts/claude-hud.git
synced 2026-05-12 01:06:21 +00:00
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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user