fix: resolve cross-level dependency bug in add-dependency command

- Fix isCircularDependency function to properly handle numeric task ID lookups
- Add robust comparison for both string and numeric task IDs
- Add comprehensive test cases for cross-level dependency scenarios
- Resolves issue where subtasks could not depend on top-level tasks

Fixes #542

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

Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com>
This commit is contained in:
claude[bot]
2025-09-08 19:39:38 +00:00
committed by Ralph Khreish
parent b9e644c556
commit 79b22a86e7
2 changed files with 149 additions and 2 deletions

View File

@@ -396,8 +396,9 @@ function isCircularDependency(tasks, taskId, chain = []) {
task = parentTask.subtasks.find((st) => st.id === subtaskId);
}
} else {
// Regular task
task = tasks.find((t) => String(t.id) === taskIdStr);
// Regular task - handle both string and numeric task IDs
const taskIdNum = parseInt(taskIdStr, 10);
task = tasks.find((t) => t.id === taskIdNum || String(t.id) === taskIdStr);
}
if (!task) {