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

@@ -1,5 +1,5 @@
import path from 'path';
import { log, readJSON, writeJSON, setTasksForTag } from '../utils.js';
import { log, readJSON, writeJSON, setTasksForTag, normalizeTaskIds } from '../utils.js';
import { isTaskDependentOn } from '../task-manager.js';
import generateTaskFiles from './generate-task-files.js';
@@ -79,6 +79,8 @@ async function moveTask(
// Get the tasks for the current tag
const tasks = rawData[tag].tasks;
normalizeTaskIds(tasks);
log(
'info',