feat: add timestamp to context header

Display current date/time in context header for both terminal (Color)
and markdown formatters. Shows format like "2026-01-04 2:46am EST".

Also bumps version to 8.5.9.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-01-04 02:49:28 -05:00
parent 9399374560
commit 91446c69e5
9 changed files with 133 additions and 103 deletions
@@ -14,13 +14,28 @@ import { colors } from '../types.js';
import { ModeManager } from '../../domain/ModeManager.js';
import { formatObservationTokenDisplay } from '../TokenCalculator.js';
/**
* Format current date/time for header display
*/
function formatHeaderDateTime(): string {
const now = new Date();
const date = now.toLocaleDateString('en-CA'); // YYYY-MM-DD format
const time = now.toLocaleTimeString('en-US', {
hour: 'numeric',
minute: '2-digit',
hour12: true
}).toLowerCase().replace(' ', '');
const tz = now.toLocaleTimeString('en-US', { timeZoneName: 'short' }).split(' ').pop();
return `${date} ${time} ${tz}`;
}
/**
* Render colored header
*/
export function renderColorHeader(project: string): string[] {
return [
'',
`${colors.bright}${colors.cyan}[${project}] recent context${colors.reset}`,
`${colors.bright}${colors.cyan}[${project}] recent context, ${formatHeaderDateTime()}${colors.reset}`,
`${colors.gray}${'─'.repeat(60)}${colors.reset}`,
''
];
@@ -219,5 +234,5 @@ export function renderColorFooter(totalDiscoveryTokens: number, totalReadTokens:
* Render colored empty state
*/
export function renderColorEmptyState(project: string): string {
return `\n${colors.bright}${colors.cyan}[${project}] recent context${colors.reset}\n${colors.gray}${'─'.repeat(60)}${colors.reset}\n\n${colors.dim}No previous sessions found for this project yet.${colors.reset}\n`;
return `\n${colors.bright}${colors.cyan}[${project}] recent context, ${formatHeaderDateTime()}${colors.reset}\n${colors.gray}${'─'.repeat(60)}${colors.reset}\n\n${colors.dim}No previous sessions found for this project yet.${colors.reset}\n`;
}
@@ -14,12 +14,27 @@ import type {
import { ModeManager } from '../../domain/ModeManager.js';
import { formatObservationTokenDisplay } from '../TokenCalculator.js';
/**
* Format current date/time for header display
*/
function formatHeaderDateTime(): string {
const now = new Date();
const date = now.toLocaleDateString('en-CA'); // YYYY-MM-DD format
const time = now.toLocaleTimeString('en-US', {
hour: 'numeric',
minute: '2-digit',
hour12: true
}).toLowerCase().replace(' ', '');
const tz = now.toLocaleTimeString('en-US', { timeZoneName: 'short' }).split(' ').pop();
return `${date} ${time} ${tz}`;
}
/**
* Render markdown header
*/
export function renderMarkdownHeader(project: string): string[] {
return [
`# [${project}] recent context`,
`# [${project}] recent context, ${formatHeaderDateTime()}`,
''
];
}
@@ -222,5 +237,5 @@ export function renderMarkdownFooter(totalDiscoveryTokens: number, totalReadToke
* Render markdown empty state
*/
export function renderMarkdownEmptyState(project: string): string {
return `# [${project}] recent context\n\nNo previous sessions found for this project yet.`;
return `# [${project}] recent context, ${formatHeaderDateTime()}\n\nNo previous sessions found for this project yet.`;
}