@lovelybunch/api 1.0.70 → 1.0.71-alpha.1

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.
@@ -57,7 +57,10 @@ app.get('/:filename', async (c) => {
57
57
  const knowledgePath = getKnowledgePath();
58
58
  const actualFilename = filename.endsWith('.md') ? filename : `${filename}.md`;
59
59
  const filePath = path.join(knowledgePath, actualFilename);
60
- const fileContent = await fs.readFile(filePath, 'utf-8');
60
+ const [fileContent, stats] = await Promise.all([
61
+ fs.readFile(filePath, 'utf-8'),
62
+ fs.stat(filePath)
63
+ ]);
61
64
  const { data, content } = matter(fileContent);
62
65
  // Extract title from metadata, first heading, or use filename
63
66
  const title = data.title ||
@@ -68,7 +71,7 @@ app.get('/:filename', async (c) => {
68
71
  metadata: {
69
72
  ...data,
70
73
  title, // Include title in metadata
71
- updated: data.updated || new Date().toISOString(),
74
+ updated: stats.mtime.toISOString(),
72
75
  tags: data.tags || [],
73
76
  sources: data.sources || []
74
77
  },
@@ -62,7 +62,10 @@ app.get('/', async (c) => {
62
62
  .filter(file => file.endsWith('.md'))
63
63
  .map(async (file) => {
64
64
  const filePath = path.join(knowledgePath, file);
65
- const fileContent = await fs.readFile(filePath, 'utf-8');
65
+ const [fileContent, stats] = await Promise.all([
66
+ fs.readFile(filePath, 'utf-8'),
67
+ fs.stat(filePath)
68
+ ]);
66
69
  const { data, content } = matter(fileContent);
67
70
  // Extract title from metadata, first heading, or use filename
68
71
  const title = data.title ||
@@ -73,7 +76,7 @@ app.get('/', async (c) => {
73
76
  metadata: {
74
77
  ...data,
75
78
  title, // Include title in metadata
76
- updated: data.updated || new Date().toISOString(),
79
+ updated: stats.mtime.toISOString(),
77
80
  tags: data.tags || [],
78
81
  sources: data.sources || []
79
82
  },