mirror of
https://github.com/jarrodwatts/claude-hud.git
synced 2026-05-04 19:42:40 +00:00
feat: display project folder name in session line (#18)
feat: display project folder name in session line - Add project folder name with 📁 emoji at start of session line - Use path.basename() for cross-platform compatibility - Add tests for POSIX/Windows paths and edge cases Co-authored-by: Tsopic <39419095+Tsopic@users.noreply.github.com>
This commit is contained in:
@@ -99,6 +99,37 @@ test('renderSessionLine includes config counts when present', () => {
|
||||
assert.ok(line.includes('hooks'));
|
||||
});
|
||||
|
||||
test('renderSessionLine displays project name from POSIX cwd', () => {
|
||||
const ctx = baseContext();
|
||||
ctx.stdin.cwd = '/Users/jarrod/my-project';
|
||||
const line = renderSessionLine(ctx);
|
||||
assert.ok(line.includes('my-project'));
|
||||
assert.ok(!line.includes('/Users/jarrod'));
|
||||
});
|
||||
|
||||
test('renderSessionLine displays project name from Windows cwd', { skip: process.platform !== 'win32' }, () => {
|
||||
const ctx = baseContext();
|
||||
ctx.stdin.cwd = 'C:\\Users\\jarrod\\my-project';
|
||||
const line = renderSessionLine(ctx);
|
||||
assert.ok(line.includes('my-project'));
|
||||
assert.ok(!line.includes('C:\\'));
|
||||
});
|
||||
|
||||
test('renderSessionLine handles root path gracefully', () => {
|
||||
const ctx = baseContext();
|
||||
ctx.stdin.cwd = '/';
|
||||
const line = renderSessionLine(ctx);
|
||||
assert.ok(line.includes('[Opus]'));
|
||||
});
|
||||
|
||||
test('renderSessionLine omits project name when cwd is undefined', () => {
|
||||
const ctx = baseContext();
|
||||
ctx.stdin.cwd = undefined;
|
||||
const line = renderSessionLine(ctx);
|
||||
assert.ok(line.includes('[Opus]'));
|
||||
assert.ok(!line.includes('📁'));
|
||||
});
|
||||
|
||||
test('renderToolsLine renders running and completed tools', () => {
|
||||
const ctx = baseContext();
|
||||
ctx.transcript.tools = [
|
||||
|
||||
Reference in New Issue
Block a user