Conversation
Adds advanced browsing, detailed entry viewing, and field-level editing for all data types. Introduces HTML formatting for rich text fields, external editor integration, and improved array and tag management. Updates the main menu UI and refactors editing workflows for a more user-friendly experience.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
❌ Deploy Preview for venerable-sherbet-c490a5 failed.
|
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a comprehensive Portfolio Data Manager CLI that provides an interactive interface for managing portfolio static data files including experiences, projects, organizations, and awards. The CLI offers full CRUD operations, data validation, export capabilities, and detailed viewing options while maintaining data integrity and safety through confirmation prompts and automatic validation.
- Adds a complete data management CLI with interactive menus for browsing, adding, editing, and deleting portfolio entries
- Implements comprehensive data validation with schema checking, duplicate ID detection, and field validation
- Provides export functionality for JSON and CSV formats with timestamped backups
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| scripts/data-manager.js | Main CLI application implementing the complete data management interface with validation, CRUD operations, and export features |
| scripts/README.md | Comprehensive documentation covering CLI features, usage examples, validation rules, best practices, and troubleshooting |
| package.json | Adds three new npm scripts for running the CLI in different modes (interactive, view-only, validate-only) |
| optional: ['github', 'url', 'code', 'tags', 'images', 'additionalInformation'], | ||
| nested: { | ||
| tags: { | ||
| required: ['name', 'color', 'background'], |
There was a problem hiding this comment.
The tags schema requires 'name', 'color', and 'background' fields, but the processTags method at line 798 only sets default values for 'color' and 'background'. This creates inconsistency where manually created tags might not match the schema requirements.
| loadAllData() { | ||
| for (const [type, filePath] of Object.entries(DATA_FILES)) { | ||
| try { | ||
| delete require.cache[require.resolve(path.resolve(filePath))]; |
There was a problem hiding this comment.
The require.cache deletion could fail if the file doesn't exist or has never been required before, causing an error. The deletion should be wrapped in a try-catch or check if the resolved path exists in the cache first.
|
|
||
| // Get next ID | ||
| const existingIds = this.currentData[type].map(item => item.id); | ||
| const nextId = existingIds.length > 0 ? Math.max(...existingIds) + 1 : 0; |
There was a problem hiding this comment.
Using Math.max(...existingIds) will throw an error if existingIds contains non-numeric values. The code should validate that all IDs are numbers or handle mixed types appropriately.
| const nextId = existingIds.length > 0 ? Math.max(...existingIds) + 1 : 0; | |
| const numericIds = existingIds.filter(id => typeof id === 'number' && !isNaN(id)); | |
| const nextId = numericIds.length > 0 ? Math.max(...numericIds) + 1 : 0; |
| console.log(`\nOpening ${tempFile} in external editor...`); | ||
| console.log('Save and close the file when done editing.'); | ||
|
|
||
| const editor = process.env.EDITOR || 'nano'; |
There was a problem hiding this comment.
The fallback to 'nano' may not work on all systems (e.g., Windows). Consider using a cross-platform approach or checking for available editors like 'notepad' on Windows.
| const editor = process.env.EDITOR || 'nano'; | |
| let editor = process.env.EDITOR; | |
| if (!editor) { | |
| if (process.platform === 'win32') { | |
| editor = 'notepad'; | |
| } else { | |
| editor = 'nano'; | |
| } | |
| } |
| // Special handling for projects to include projectTags | ||
| if (type === 'projects') { | ||
| // Read existing file to preserve projectTags | ||
| const existingContent = fs.readFileSync(filePath, 'utf8'); |
There was a problem hiding this comment.
Reading the file synchronously without error handling could cause the application to crash if the file doesn't exist or is inaccessible. This should be wrapped in a try-catch block.
| const existingContent = fs.readFileSync(filePath, 'utf8'); | |
| let existingContent = ''; | |
| try { | |
| existingContent = fs.readFileSync(filePath, 'utf8'); | |
| } catch (error) { | |
| // If the file doesn't exist or can't be read, skip preserving projectTags | |
| existingContent = ''; | |
| } |
|
|
||
| // Type-specific validations | ||
| if (type === 'experiences' && item.url && Array.isArray(item.url)) { | ||
| item.url.forEach((url, urlIndex) => { |
There was a problem hiding this comment.
The code assumes item.url is an array when it's checked with Array.isArray(item.url), but then directly calls forEach without verifying the array isn't empty or that each element exists.
This pull request introduces a new data management CLI for portfolio static data and documents its features and usage. The most significant changes are the addition of several new npm scripts to run the CLI and the inclusion of a comprehensive README describing the CLI's capabilities, usage, and technical details.
CLI Integration and Documentation:
package.jsonfor running, viewing, and validating data via the CLI (data,data:view,data:validate).scripts/README.mdthat documents the Portfolio Data Manager CLI, including quick start instructions, feature overview, supported data types, usage examples, validation rules, best practices, troubleshooting, and future enhancements.