This commit is contained in:
2025-09-05 14:38:22 -05:00
commit 4ffef1cc88
8 changed files with 272 additions and 0 deletions

28
src/noteOrganizer.js Normal file
View File

@@ -0,0 +1,28 @@
// Module to organize notes by bridging other modules
const path = require('path');
const { getFileContents } = require('./fileReader');
const { organizeNotesWithAI } = require('./aiProcessor');
/**
* Orchestrates the process of reading, processing, and organizing notes.
* @param {string} dirPath - The path to the directory containing notes.
* @param {string} pattern - The file name pattern to match.
* @returns {Promise<string|null>} - The organized notes as a single markdown string, or null on error.
*/
async function processAndOrganizeNotes(dirPath, pattern) {
const fileData = getFileContents(dirPath, pattern);
if (fileData.length === 0) {
console.log('No matching files found to organize.');
return null;
}
const contextualizedNotes = fileData.map(data => {
const fileName = path.basename(data.filePath);
return `--- Note from ${fileName} ---\n\n${data.content}`;
});
const organizedNotes = await organizeNotesWithAI(contextualizedNotes);
return organizedNotes;
}
module.exports = { processAndOrganizeNotes };