Initial commit of MyWorkspace - contains multiple projects and global workspace configuration

This commit is contained in:
DavidSaylor
2026-05-06 22:59:37 -05:00
commit 019e35b488
2520 changed files with 13634 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
// Notes Parser Utilities
// Handles parsing and formatting of structured notes
(function() {
'use strict';
const NotesParser = {
// Parse raw notes string into structured object
parse(noteString) {
if (!noteString) {
return {
path: '',
userNotes: '',
autoTags: []
};
}
try {
const parsed = JSON.parse(noteString);
// Validate structure
if (typeof parsed === 'object' && parsed !== null) {
return {
path: parsed.path || '',
userNotes: parsed.userNotes || '',
autoTags: parsed.autoTags || []
};
}
} catch (e) {
// Invalid JSON, treat as plain notes
}
return {
path: '',
userNotes: noteString,
autoTags: []
};
},
// Format structured notes for storage
format(notesObject) {
if (!notesObject) {
return '';
}
const notes = {
path: notesObject.path || '',
userNotes: notesObject.userNotes || '',
autoTags: notesObject.autoTags || []
};
return JSON.stringify(notes);
},
// Extract just the user notes (for display)
extractUserNotes(noteString) {
const parsed = this.parse(noteString);
return parsed.userNotes;
},
// Extract just the path (for sync operations)
extractPath(noteString) {
const parsed = this.parse(noteString);
return parsed.path;
},
// Extract auto-generated tags
extractAutoTags(noteString) {
const parsed = this.parse(noteString);
return parsed.autoTags || [];
},
// Generate tags from path
generateTagsFromPath(path) {
if (!path) {
return [];
}
// Split by slash and filter empty
const folders = path.split('/').filter(f => f);
return folders.map(folder => ({
name: folder.trim()
}));
},
// Merge two notes objects
merge(notes1, notes2) {
const parsed1 = this.parse(notes1);
const parsed2 = this.parse(notes2);
return {
path: parsed1.path || parsed2.path,
userNotes: parsed1.userNotes || parsed2.userNotes,
autoTags: [...(parsed1.autoTags || []), ...(parsed2.autoTags || [])]
.filter((v, i, a) => a.indexOf(v) === i) // Remove duplicates
};
},
// Validate notes structure
validate(notesObject) {
if (!notesObject || typeof notesObject !== 'object') {
return false;
}
return !!notesObject.path || !!notesObject.userNotes;
},
// Create minimal notes object
createEmpty() {
return {
path: '',
userNotes: '',
autoTags: []
};
}
};
// Export for use in other scripts
window.NotesParser = NotesParser;
})();