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:
@@ -10,7 +10,7 @@
|
||||
"plugins": [
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "8.5.8",
|
||||
"version": "8.5.9",
|
||||
"source": "./plugin",
|
||||
"description": "Persistent memory system for Claude Code - context compression across sessions"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "8.5.8",
|
||||
"version": "8.5.9",
|
||||
"description": "Memory compression system for Claude Code - persist context across sessions",
|
||||
"keywords": [
|
||||
"claude",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-mem",
|
||||
"version": "8.5.8",
|
||||
"version": "8.5.9",
|
||||
"description": "Persistent memory system for Claude Code - seamlessly preserve context across sessions",
|
||||
"author": {
|
||||
"name": "Alex Newman"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-mem-plugin",
|
||||
"version": "8.5.7",
|
||||
"version": "8.5.9",
|
||||
"private": true,
|
||||
"description": "Runtime dependencies for claude-mem bundled hooks",
|
||||
"type": "module",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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.`;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ describe('MarkdownFormatter', () => {
|
||||
const result = renderMarkdownHeader('my-project');
|
||||
|
||||
expect(result).toHaveLength(2);
|
||||
expect(result[0]).toBe('# [my-project] recent context');
|
||||
expect(result[0]).toMatch(/^# \[my-project\] recent context, \d{4}-\d{2}-\d{2} \d{1,2}:\d{2}[ap]m [A-Z]{3,4}$/);
|
||||
expect(result[1]).toBe('');
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@ describe('MarkdownFormatter', () => {
|
||||
it('should handle empty project name', () => {
|
||||
const result = renderMarkdownHeader('');
|
||||
|
||||
expect(result[0]).toBe('# [] recent context');
|
||||
expect(result[0]).toMatch(/^# \[\] recent context, \d{4}-\d{2}-\d{2} \d{1,2}:\d{2}[ap]m [A-Z]{3,4}$/);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user