chore: run formatting on codebase to pass CI

This commit is contained in:
Ralph Khreish
2025-04-09 10:07:49 +02:00
parent 01a5be25a8
commit 5e01399dca

View File

@@ -2856,7 +2856,12 @@ async function expandAllTasks(
mcpLog mcpLog
); );
if (aiResponse && aiResponse.subtasks && Array.isArray(aiResponse.subtasks) && aiResponse.subtasks.length > 0) { if (
aiResponse &&
aiResponse.subtasks &&
Array.isArray(aiResponse.subtasks) &&
aiResponse.subtasks.length > 0
) {
// Process and add the subtasks to the task // Process and add the subtasks to the task
task.subtasks = aiResponse.subtasks.map((subtask, index) => ({ task.subtasks = aiResponse.subtasks.map((subtask, index) => ({
id: index + 1, id: index + 1,
@@ -2873,15 +2878,18 @@ async function expandAllTasks(
// Handle error response // Handle error response
const errorMsg = `Failed to generate subtasks for task ${task.id}: ${aiResponse.error}`; const errorMsg = `Failed to generate subtasks for task ${task.id}: ${aiResponse.error}`;
report(errorMsg, 'error'); report(errorMsg, 'error');
// Add task ID to error info and provide actionable guidance // Add task ID to error info and provide actionable guidance
const suggestion = aiResponse.suggestion.replace('<id>', task.id); const suggestion = aiResponse.suggestion.replace('<id>', task.id);
report(`Suggestion: ${suggestion}`, 'info'); report(`Suggestion: ${suggestion}`, 'info');
expansionErrors++; expansionErrors++;
} else { } else {
report(`Failed to generate subtasks for task ${task.id}`, 'error'); report(`Failed to generate subtasks for task ${task.id}`, 'error');
report(`Suggestion: Run 'task-master update-task --id=${task.id} --prompt="Generate subtasks for this task"' to manually create subtasks.`, 'info'); report(
`Suggestion: Run 'task-master update-task --id=${task.id} --prompt="Generate subtasks for this task"' to manually create subtasks.`,
'info'
);
expansionErrors++; expansionErrors++;
} }
} catch (error) { } catch (error) {
@@ -5628,7 +5636,7 @@ async function getSubtasksFromAI(
} }
let responseText; let responseText;
// Call the AI - with research if requested // Call the AI - with research if requested
if (useResearch && perplexity) { if (useResearch && perplexity) {
if (mcpLog) { if (mcpLog) {
@@ -5677,8 +5685,14 @@ async function getSubtasksFromAI(
// Try to parse the subtasks // Try to parse the subtasks
try { try {
const parsedSubtasks = parseSubtasksFromText(responseText); const parsedSubtasks = parseSubtasksFromText(responseText);
if (!parsedSubtasks || !Array.isArray(parsedSubtasks) || parsedSubtasks.length === 0) { if (
throw new Error('Failed to parse valid subtasks array from AI response'); !parsedSubtasks ||
!Array.isArray(parsedSubtasks) ||
parsedSubtasks.length === 0
) {
throw new Error(
'Failed to parse valid subtasks array from AI response'
);
} }
return { subtasks: parsedSubtasks }; return { subtasks: parsedSubtasks };
} catch (parseError) { } catch (parseError) {
@@ -5689,10 +5703,11 @@ async function getSubtasksFromAI(
log('error', `Error parsing subtasks: ${parseError.message}`); log('error', `Error parsing subtasks: ${parseError.message}`);
} }
// Return error information instead of fallback subtasks // Return error information instead of fallback subtasks
return { return {
error: parseError.message, error: parseError.message,
taskId: null, // This will be filled in by the calling function taskId: null, // This will be filled in by the calling function
suggestion: "Use 'task-master update-task --id=<id> --prompt=\"Generate subtasks for this task\"' to manually create subtasks." suggestion:
'Use \'task-master update-task --id=<id> --prompt="Generate subtasks for this task"\' to manually create subtasks.'
}; };
} }
} catch (error) { } catch (error) {
@@ -5702,10 +5717,11 @@ async function getSubtasksFromAI(
log('error', `Error generating subtasks: ${error.message}`); log('error', `Error generating subtasks: ${error.message}`);
} }
// Return error information instead of fallback subtasks // Return error information instead of fallback subtasks
return { return {
error: error.message, error: error.message,
taskId: null, // This will be filled in by the calling function taskId: null, // This will be filled in by the calling function
suggestion: "Use 'task-master update-task --id=<id> --prompt=\"Generate subtasks for this task\"' to manually create subtasks." suggestion:
'Use \'task-master update-task --id=<id> --prompt="Generate subtasks for this task"\' to manually create subtasks.'
}; };
} }
} }