@getlore/cli 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -289,7 +289,7 @@ export function getSelectedSource(state) {
289
289
  */
290
290
  export function renderList(ui, state) {
291
291
  const width = ui.listContent.width - 2;
292
- const height = ui.listContent.height - 1;
292
+ const height = ui.listContent.height;
293
293
  const lines = [];
294
294
  if (state.filtered.length === 0) {
295
295
  lines.push('');
@@ -328,8 +328,12 @@ function renderFlatList(ui, state, width, height, lines) {
328
328
  if (state.selectedIndex >= itemsVisible) {
329
329
  visibleStart = state.selectedIndex - itemsVisible + 1;
330
330
  }
331
- const visibleEnd = Math.min(state.filtered.length, visibleStart + itemsVisible);
332
- for (let i = visibleStart; i < visibleEnd; i++) {
331
+ // Render items until we fill the viewport
332
+ let linesUsed = 0;
333
+ for (let i = visibleStart; i < state.filtered.length; i++) {
334
+ if (linesUsed + linesPerItem > height)
335
+ break;
336
+ linesUsed += linesPerItem;
333
337
  const source = state.filtered[i];
334
338
  const isSelected = i === state.selectedIndex;
335
339
  renderDocumentItem(source, isSelected, width, lines, true);
@@ -339,15 +343,27 @@ function renderFlatList(ui, state, width, height, lines) {
339
343
  * Render grouped list with collapsible project folders
340
344
  */
341
345
  function renderGroupedList(ui, state, width, height, lines) {
342
- // Calculate lines per item (headers take 2, docs take 3)
343
- const avgLinesPerItem = 2.5;
344
- const itemsVisible = Math.floor(height / avgLinesPerItem);
346
+ // Calculate line height for each item type
347
+ const itemLineHeight = (i) => state.listItems[i]?.type === 'header' ? 2 : 3;
348
+ // Find visibleStart: scroll so selectedIndex is visible
345
349
  let visibleStart = 0;
346
- if (state.selectedIndex >= itemsVisible) {
347
- visibleStart = state.selectedIndex - itemsVisible + 1;
348
- }
349
- const visibleEnd = Math.min(state.listItems.length, visibleStart + itemsVisible);
350
- for (let i = visibleStart; i < visibleEnd; i++) {
350
+ // Count lines from visibleStart to selectedIndex (inclusive)
351
+ let linesFromStartToSelected = 0;
352
+ for (let i = 0; i <= state.selectedIndex; i++) {
353
+ linesFromStartToSelected += itemLineHeight(i);
354
+ }
355
+ // If selectedIndex doesn't fit, scroll forward
356
+ while (linesFromStartToSelected > height && visibleStart < state.selectedIndex) {
357
+ linesFromStartToSelected -= itemLineHeight(visibleStart);
358
+ visibleStart++;
359
+ }
360
+ // Render items until we fill the viewport
361
+ let linesUsed = 0;
362
+ for (let i = visibleStart; i < state.listItems.length; i++) {
363
+ const h = itemLineHeight(i);
364
+ if (linesUsed + h > height)
365
+ break;
366
+ linesUsed += h;
351
367
  const item = state.listItems[i];
352
368
  const isSelected = i === state.selectedIndex;
353
369
  if (item.type === 'header') {
@@ -377,7 +393,7 @@ function renderProjectHeader(item, isSelected, width, lines) {
377
393
  * Render a document item row
378
394
  */
379
395
  function renderDocumentItem(source, isSelected, width, lines, showProject) {
380
- const date = formatDate(source.created_at);
396
+ const date = formatDate(source.indexed_at || source.created_at);
381
397
  const contentType = source.content_type || 'document';
382
398
  const project = source.projects[0] || '';
383
399
  // Format content type as a tag
@@ -10,6 +10,7 @@ export interface SourceItem {
10
10
  content_type: ContentType;
11
11
  projects: string[];
12
12
  created_at: string;
13
+ indexed_at: string;
13
14
  summary: string;
14
15
  score?: number;
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlore/cli",
3
- "version": "0.5.2",
3
+ "version": "0.7.0",
4
4
  "description": "Research knowledge repository with semantic search, citations, and project lineage tracking",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "bugs": {
45
45
  "url": "https://github.com/getlore-ai/lore/issues"
46
46
  },
47
- "license": "UNLICENSED",
47
+ "license": "MIT",
48
48
  "engines": {
49
49
  "node": ">=18"
50
50
  },
@@ -58,6 +58,7 @@
58
58
  "chokidar": "^5.0.0",
59
59
  "commander": "^12.1.0",
60
60
  "dotenv": "^17.2.3",
61
+ "exifr": "^7.1.3",
61
62
  "openai": "^4.77.0",
62
63
  "pdf-parse": "^2.4.5",
63
64
  "zod": "^3.24.0"