@@ -39,7 +39,7 @@ export function readLastLines(filePath: string, lineCount: number = 100): string
3939 * Read a JSONL (JSON Lines) file and parse each line
4040 *
4141 * @param filePath Path to the JSONL file
42- * @param maxLines Optional maximum number of lines to read (reads from end)
42+ * @param maxLines Maximum number of lines to read from end (default: 1000 )
4343 * @returns Array of parsed objects
4444 *
4545 * @example
@@ -48,10 +48,8 @@ export function readLastLines(filePath: string, lineCount: number = 100): string
4848 * const recent = readJsonLines<MyType>('/path/to/data.jsonl', 100);
4949 * ```
5050 */
51- export function readJsonLines < T = any > ( filePath : string , maxLines ?: number ) : T [ ] {
52- const lines = maxLines !== undefined
53- ? readLastLines ( filePath , maxLines )
54- : readLastLines ( filePath , Number . MAX_SAFE_INTEGER ) ;
51+ export function readJsonLines < T = any > ( filePath : string , maxLines : number = 1000 ) : T [ ] {
52+ const lines = readLastLines ( filePath , maxLines ) ;
5553
5654 return lines . map ( line => {
5755 try {
@@ -62,22 +60,6 @@ export function readJsonLines<T = any>(filePath: string, maxLines?: number): T[]
6260 } ) . filter ( ( entry ) : entry is T => entry !== null ) ;
6361}
6462
65- /**
66- * Read last N lines from a JSONL file and parse them
67- *
68- * @param filePath Path to the JSONL file
69- * @param lineCount Number of lines to read from the end (default: 100)
70- * @returns Array of parsed objects
71- *
72- * @example
73- * ```typescript
74- * const recent = readLastJsonLines<HistoryEntry>('~/.claude/history.jsonl', 50);
75- * ```
76- */
77- export function readLastJsonLines < T = any > ( filePath : string , lineCount : number = 100 ) : T [ ] {
78- return readJsonLines < T > ( filePath , lineCount ) ;
79- }
80-
8163/**
8264 * Check if a file exists
8365 *
0 commit comments