claude-conversation-manager
Version:
A CLI tool for managing Claude Code conversation history with parsing and i18n support
110 lines (109 loc) • 2.58 kB
TypeScript
export interface ConversationSummary {
type: 'summary';
summary: string;
leafUuid: string;
}
export interface ConversationMessage {
parentUuid?: string | null;
isSidechain?: boolean;
userType?: string;
cwd?: string;
sessionId: string;
version?: string;
gitBranch?: string;
type: 'user' | 'assistant';
message: {
role: 'user' | 'assistant';
content: Array<{
type: string;
text: string;
}> | string;
model?: string;
usage?: {
input_tokens: number;
output_tokens: number;
cache_creation_input_tokens?: number;
cache_read_input_tokens?: number;
};
};
isMeta?: boolean;
uuid: string;
timestamp: string;
}
export interface ConversationMetadata {
id: string;
projectPath: string;
workingDirectory: string;
summary: string;
messageCount: number;
fileSize: number;
created: Date;
modified: Date;
isCorrupted: boolean;
corruptionReason?: string;
gitBranch?: string;
}
export interface ConversationFile {
filePath: string;
metadata: ConversationMetadata;
messages: ConversationMessage[];
summary?: ConversationSummary;
}
export interface ManagerConfig {
claudeConfigPath: string;
projectsPath: string;
backupPath: string;
maxBackups: number;
autoBackup: boolean;
}
export interface SearchOptions {
keyword?: string;
project?: string;
dateFrom?: Date;
dateTo?: Date;
minSize?: number;
maxSize?: number;
corrupted?: boolean;
hasGitBranch?: boolean;
}
export interface ExportOptions {
format: 'markdown' | 'json' | 'text';
includeMetadata: boolean;
outputPath?: string;
}
export interface BackupInfo {
timestamp: Date;
filename: string;
size: number;
conversationCount: number;
projectPaths: string[];
}
export type MemoryItemType = 'decision' | 'task' | 'file' | 'issue' | 'note';
export interface MemorySession {
id: string;
sourceFile: string;
summary: string;
messageCount: number;
createdAt: string;
updatedAt: string;
}
export interface MemoryItem {
id: string;
type: MemoryItemType;
text: string;
sourceSessionId: string;
sourceFile: string;
timestamp: string;
score: number;
}
export interface MemoryFile {
version: 1;
projectPath: string;
updatedAt: string;
sessions: MemorySession[];
items: MemoryItem[];
}
export interface MemorySearchResult {
item: MemoryItem;
score: number;
}