fix(tags): Resolve critical tag deletion and migration notice bugs
Major Issues Fixed: 1. Tag Deletion Bug: Fixed critical issue where creating subtasks would delete other tags - Root cause: writeJSON function wasn't accepting projectRoot/tag parameters - Fixed writeJSON signature and logic to handle tagged data structure - Added proper merging of resolved tag data back into full tagged structure 2. Persistent Migration Notice: Fixed FYI notice showing after every command - Root cause: markMigrationForNotice was resetting migrationNoticeShown to false - Fixed migration logic to only trigger on actual legacy->tagged migrations - Added proper _rawTaggedData checks to prevent false migration detection 3. Data Corruption Prevention: Enhanced data integrity safeguards - Fixed writeJSON to filter out internal properties - Added automatic cleanup of rogue properties - Improved hasTaggedStructure detection logic Commands Fixed: add-subtask, remove-subtask, and all commands now preserve tags correctly
This commit is contained in:
@@ -226,12 +226,18 @@ async function addTask(
|
||||
}
|
||||
|
||||
// Handle legacy format migration using utilities
|
||||
if (rawData && Array.isArray(rawData.tasks)) {
|
||||
report('Migrating legacy tasks.json format to tagged format...', 'info');
|
||||
const legacyTasks = rawData.tasks;
|
||||
if (rawData && Array.isArray(rawData.tasks) && !rawData._rawTaggedData) {
|
||||
report('Legacy format detected. Migrating to tagged format...', 'info');
|
||||
|
||||
// This is legacy format - migrate it to tagged format
|
||||
rawData = {
|
||||
master: {
|
||||
tasks: legacyTasks
|
||||
tasks: rawData.tasks,
|
||||
metadata: rawData.metadata || {
|
||||
created: new Date().toISOString(),
|
||||
updated: new Date().toISOString(),
|
||||
description: 'Tasks for master context'
|
||||
}
|
||||
}
|
||||
};
|
||||
// Ensure proper metadata using utility
|
||||
|
||||
Reference in New Issue
Block a user