format: fixed formatting issues

This commit is contained in:
Shrey Paharia
2025-04-19 04:06:14 +05:30
parent 521cf0e5f0
commit 5e5e20391a
2 changed files with 28 additions and 11 deletions

View File

@@ -280,14 +280,14 @@ function findTaskById(tasks, taskId) {
if (taskResult) {
// Try to read complexity report
const complexityReport = readComplexityReport();
if (complexityReport && complexityReport.complexityAnalysis) {
// For a main task, look for a direct match
if (!taskResult.isSubtask) {
const taskAnalysis = complexityReport.complexityAnalysis.find(
analysis => analysis.taskId === taskResult.id
(analysis) => analysis.taskId === taskResult.id
);
if (taskAnalysis) {
taskResult.complexityScore = taskAnalysis.complexityScore;
}
@@ -421,6 +421,23 @@ function detectCamelCaseFlags(args) {
// Export all utility functions and configuration
export {
CONFIG, detectCamelCaseFlags, disableSilentMode, enableSilentMode, findCycles, findTaskById, findTaskInComplexityReport, formatTaskId, getTaskManager, isSilentMode, log, LOG_LEVELS, readComplexityReport, readJSON, sanitizePrompt, taskExists, toKebabCase, truncate, writeJSON
CONFIG,
detectCamelCaseFlags,
disableSilentMode,
enableSilentMode,
findCycles,
findTaskById,
findTaskInComplexityReport,
formatTaskId,
getTaskManager,
isSilentMode,
log,
LOG_LEVELS,
readComplexityReport,
readJSON,
sanitizePrompt,
taskExists,
toKebabCase,
truncate,
writeJSON
};

View File

@@ -11,7 +11,7 @@ const mockReadComplexityReport = jest.fn().mockReturnValue(null);
jest.mock('../../scripts/modules/utils.js', () => {
// Get the original module
const originalModule = jest.requireActual('../../scripts/modules/utils.js');
// Return a modified version
return {
...originalModule,
@@ -97,7 +97,7 @@ describe('Task Finder', () => {
});
const task = findTaskById(sampleTasks.tasks, 2);
expect(task).toBeDefined();
expect(task.id).toBe(2);
expect(task.complexityScore).toBe(8);
@@ -108,9 +108,9 @@ describe('Task Finder', () => {
mockReadComplexityReport.mockReturnValue({
complexityAnalysis: [{ taskId: 999, complexityScore: 5 }]
});
const task = findTaskById(sampleTasks.tasks, 2);
expect(task).toBeDefined();
expect(task.id).toBe(2);
expect(task.complexityScore).toBeUndefined();
@@ -119,9 +119,9 @@ describe('Task Finder', () => {
test('should work correctly when no complexity report exists', () => {
// Set up mock implementation for this test
mockReadComplexityReport.mockReturnValue(null);
const task = findTaskById(sampleTasks.tasks, 2);
expect(task).toBeDefined();
expect(task.id).toBe(2);
expect(task.complexityScore).toBeUndefined();