this repo has no description
at main 199 lines 4.4 kB view raw
1// Session source discriminator 2export type SessionSource = 'claude' | 'codex'; 3 4// Session file discovered by detector 5export interface SessionFile { 6 path: string; 7 projectPath: string; 8 projectName: string; 9 sessionId: string; 10 modifiedAt: Date; 11 fileHash: string; 12 source: SessionSource; 13} 14 15// Raw JSONL entry from Claude Code session files 16export interface RawSessionEntry { 17 type: 'user' | 'assistant'; 18 timestamp: string; 19 uuid: string; 20 parentUuid: string | null; 21 sessionId: string; 22 cwd?: string; 23 gitBranch?: string; 24 slug?: string; 25 version?: string; 26 message: { 27 role: 'user' | 'assistant'; 28 content: MessageContent[]; 29 model?: string; 30 id?: string; 31 usage?: TokenUsage; 32 }; 33 requestId?: string; 34} 35 36export interface TokenUsage { 37 input_tokens: number; 38 output_tokens: number; 39 cache_creation_input_tokens?: number; 40 cache_read_input_tokens?: number; 41} 42 43export type MessageContent = 44 | { type: 'text'; text: string } 45 | { type: 'text'; content: string } 46 | { type: 'tool_use'; id: string; name: string; input: Record<string, unknown> } 47 | { type: 'tool_result'; tool_use_id: string; content: string; is_error?: boolean }; 48 49// Parsed session with extracted info 50export interface ParsedSession { 51 sessionId: string; 52 filePath: string; 53 projectPath: string; 54 projectName: string; 55 gitBranch: string; 56 startTime: string; 57 endTime: string; 58 date: string; // YYYY-MM-DD 59 messages: ParsedMessage[]; 60 stats: SessionStats; 61} 62 63export interface ParsedMessage { 64 type: 'user' | 'assistant'; 65 timestamp: string; 66 text: string; 67 toolUses: ToolUse[]; 68} 69 70export interface ToolUse { 71 name: string; 72 input: string; // Truncated/summarized 73 rawInput?: Record<string, unknown>; // Full input for file path extraction 74} 75 76export interface SessionStats { 77 userMessages: number; 78 assistantMessages: number; 79 toolCalls: Record<string, number>; 80 totalInputTokens?: number; 81 totalOutputTokens?: number; 82} 83 84// LLM-generated summary 85export interface SessionSummary { 86 shortSummary: string; 87 accomplishments: string[]; 88 filesChanged: string[]; 89 toolsUsed: string[]; 90} 91 92// Database models 93export interface DBSessionSummary { 94 id: number; 95 session_id: string; 96 project_path: string; 97 project_name: string | null; 98 git_branch: string | null; 99 start_time: string; 100 end_time: string; 101 date: string; 102 short_summary: string | null; 103 accomplishments: string | null; // JSON array 104 tools_used: string | null; // JSON array 105 files_changed: string | null; // JSON array 106 stats: string | null; // JSON object 107 source: SessionSource; // claude or codex 108 processed_at: string; 109} 110 111export interface DBDailySummary { 112 date: string; 113 brag_summary: string; 114 projects_worked: string; // JSON array 115 total_sessions: number; 116 generated_at: string; 117} 118 119export interface DBProcessedFile { 120 file_path: string; 121 file_hash: string; 122 processed_at: string; 123} 124 125export interface ProjectListItem { 126 path: string; 127 name: string; 128 status: ProjectStatus; 129 totalSessions: number; 130 daysSinceLastSession: number; 131} 132 133// API response types 134export interface DayListItem { 135 date: string; 136 projectCount: number; 137 sessionCount: number; 138 bragSummary?: string; 139} 140 141export interface DayDetail { 142 date: string; 143 bragSummary?: string; 144 projects: ProjectDetail[]; 145 stats: { 146 totalSessions: number; 147 totalTokens: number; 148 }; 149} 150 151export interface ProjectDetail { 152 name: string; 153 path: string; 154 sessions: SessionDetail[]; 155} 156 157export interface SessionDetail { 158 sessionId: string; 159 startTime: string; 160 endTime: string; 161 shortSummary: string; 162 accomplishments: string[]; 163 filesChanged: string[]; 164 toolsUsed: string[]; 165 stats: SessionStats; 166} 167 168// Project status tracking 169// Extensible - add more statuses here as needed 170export type ProjectStatus = 171 | 'shipped' 172 | 'in_progress' 173 | 'ready_to_ship' 174 | 'abandoned' 175 | 'ignore' 176 | 'one_off' 177 | 'experiment'; 178 179export interface DBProject { 180 id: number; 181 project_path: string; 182 project_name: string; 183 status: ProjectStatus; 184 first_session_date: string; 185 last_session_date: string; 186 total_sessions: number; 187 created_at: string; 188 updated_at: string; 189} 190 191export interface ProjectListItem { 192 path: string; 193 name: string; 194 status: ProjectStatus; 195 firstSessionDate: string; 196 lastSessionDate: string; 197 totalSessions: number; 198 daysSinceLastSession: number; 199}