fix(tasks): ensure list tasks triggers silent migration if necessary.
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
* @param {boolean} withSubtasks - Whether to show subtasks
|
||||
* @param {string} outputFormat - Output format (text or json)
|
||||
* @param {string} tag - Optional tag to override current tag resolution
|
||||
* @param {Object} context - Optional context object containing projectRoot and other options
|
||||
* @returns {Object} - Task list result for json format
|
||||
*/
|
||||
function listTasks(
|
||||
@@ -35,10 +36,13 @@ function listTasks(
|
||||
reportPath = null,
|
||||
withSubtasks = false,
|
||||
outputFormat = 'text',
|
||||
tag = null
|
||||
tag = null,
|
||||
context = {}
|
||||
) {
|
||||
try {
|
||||
const data = readJSON(tasksPath, null, tag); // Pass tag to readJSON
|
||||
// Extract projectRoot from context if provided
|
||||
const projectRoot = context.projectRoot || null;
|
||||
const data = readJSON(tasksPath, projectRoot, tag); // Pass projectRoot to readJSON
|
||||
if (!data || !data.tasks) {
|
||||
throw new Error(`No valid tasks found in ${tasksPath}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user