fix: normalize task IDs to numbers on load to fix comparison issues

- Added normalizeTaskIds function to convert string IDs to numbers
- Applied normalization in readJSON for all code paths
- Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data
- Exported normalizeTaskIds function for use in other modules
- Added test case for string ID normalization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Carl Mercier
2025-07-26 01:00:31 -05:00
committed by Ralph Khreish
parent 077cbb99de
commit ef23beac0d
4 changed files with 15 additions and 4 deletions

View File

@@ -7,7 +7,8 @@ import {
readJSON,
writeJSON,
findTaskById,
ensureTagMetadata
ensureTagMetadata,
normalizeTaskIds
} from '../utils.js';
import { displayBanner } from '../ui.js';
import { validateTaskDependencies } from '../dependency-manager.js';
@@ -76,6 +77,8 @@ async function setTaskStatus(tasksPath, taskIdInput, newStatus, options = {}) {
tag,
_rawTaggedData: rawData
};
normalizeTaskIds(data.tasks);
if (!data || !data.tasks) {
throw new Error(`No valid tasks found in ${tasksPath}`);