Release v3.6.10
Published from npm package build Source: https://github.com/thedotmack/claude-mem-source
This commit is contained in:
@@ -10,12 +10,6 @@ import {
|
||||
outputSessionStartContent
|
||||
} from '../prompts/templates/context/ContextTemplates.js';
|
||||
|
||||
interface IndexEntry {
|
||||
summary: string;
|
||||
entity: string;
|
||||
keywords: string[];
|
||||
}
|
||||
|
||||
interface TrashStatus {
|
||||
folderCount: number;
|
||||
fileCount: number;
|
||||
@@ -23,6 +17,14 @@ interface TrashStatus {
|
||||
isEmpty: boolean;
|
||||
}
|
||||
|
||||
function buildProjectMatcher(projectName: string): (value?: string) => boolean {
|
||||
const aliases = new Set<string>();
|
||||
aliases.add(projectName);
|
||||
aliases.add(projectName.replace(/-/g, '_'));
|
||||
aliases.add(projectName.replace(/_/g, '-'));
|
||||
return (value?: string) => !!value && aliases.has(value);
|
||||
}
|
||||
|
||||
function formatSize(bytes: number): string {
|
||||
if (bytes === 0) return '0 B';
|
||||
const k = 1024;
|
||||
@@ -115,20 +117,25 @@ export async function loadContext(options: OptionValues = {}): Promise<void> {
|
||||
const sessions = jsonObjects.filter(obj => obj.type === 'session');
|
||||
|
||||
// Filter each type by project if specified
|
||||
// Handle both hyphen and underscore formats since index has mixed entries
|
||||
let filteredMemories = memories;
|
||||
let filteredOverviews = overviews;
|
||||
let filteredSessions = sessions;
|
||||
if (options.project) {
|
||||
filteredMemories = memories.filter(obj => obj.project === options.project);
|
||||
filteredOverviews = overviews.filter(obj => obj.project === options.project);
|
||||
const matchesProject = buildProjectMatcher(options.project);
|
||||
filteredMemories = memories.filter(obj => matchesProject(obj.project));
|
||||
filteredOverviews = overviews.filter(obj => matchesProject(obj.project));
|
||||
filteredSessions = sessions.filter(obj => matchesProject(obj.project));
|
||||
}
|
||||
|
||||
if (options.format === 'session-start') {
|
||||
// Get last 10 memories and last 5 overviews for session-start
|
||||
const recentMemories = filteredMemories.slice(-10);
|
||||
const recentOverviews = filteredOverviews.slice(-5);
|
||||
const recentSessions = filteredSessions.slice(-5);
|
||||
|
||||
// Combine them for the display
|
||||
const recentObjects = [...recentMemories, ...recentOverviews];
|
||||
const recentObjects = [...recentSessions, ...recentMemories, ...recentOverviews];
|
||||
|
||||
// Find most recent timestamp for last session info
|
||||
let lastSessionTime = 'recently';
|
||||
@@ -195,4 +202,4 @@ export async function loadContext(options: OptionValues = {}): Promise<void> {
|
||||
console.log(createUserFriendlyError('Context loading', errorMessage, 'Check file permissions and try again'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@ function generateSessionId(message: string): string {
|
||||
* Save command - stores a message to both Chroma collection and JSONL index
|
||||
*/
|
||||
export async function save(message: string, options: OptionValues = {}): Promise<void> {
|
||||
// Debug: Log what we receive
|
||||
appendFileSync('/Users/alexnewman/.claude-mem/save-debug.log',
|
||||
`[${new Date().toISOString()}] Received message: "${message}" (type: ${typeof message}, length: ${message?.length})\n`,
|
||||
'utf8');
|
||||
|
||||
if (!message || message.trim() === '') {
|
||||
console.error('Error: Message is required');
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user