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

@@ -529,6 +529,7 @@ function readJSON(filepath, projectRoot = null, tag = null) {
// If anything goes wrong, try to return master or empty
const masterData = data.master;
if (masterData && masterData.tasks) {
normalizeTaskIds(masterData.tasks);
return {
...masterData,
_rawTaggedData: originalTaggedData
@@ -1448,5 +1449,6 @@ export {
createStateJson,
markMigrationForNotice,
flattenTasksWithSubtasks,
ensureTagMetadata
ensureTagMetadata,
normalizeTaskIds
};