chore: refactor newly added feature and fix unit tests
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
|
||||
import { getDebugFlag, getProjectName } from '../config-manager.js';
|
||||
import { getDebugFlag, getProjectName, getMainProvider, getResearchProvider } from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import {
|
||||
COMPLEXITY_REPORT_FILE,
|
||||
@@ -410,9 +410,6 @@ async function analyzeTaskComplexity(options, context = {}) {
|
||||
const promptManager = getPromptManager();
|
||||
|
||||
// Check if Claude Code is being used as the provider
|
||||
const { getMainProvider, getResearchProvider } = await import(
|
||||
'../config-manager.js'
|
||||
);
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
|
||||
@@ -18,7 +18,12 @@ import {
|
||||
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
|
||||
import { getDefaultSubtasks, getDebugFlag } from '../config-manager.js';
|
||||
import {
|
||||
getDefaultSubtasks,
|
||||
getDebugFlag,
|
||||
getMainProvider,
|
||||
getResearchProvider
|
||||
} from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
import { COMPLEXITY_REPORT_FILE } from '../../../src/constants/paths.js';
|
||||
@@ -453,9 +458,6 @@ async function expandTask(
|
||||
const promptManager = getPromptManager();
|
||||
|
||||
// Check if Claude Code is being used as the provider
|
||||
const { getMainProvider, getResearchProvider } = await import(
|
||||
'../config-manager.js'
|
||||
);
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
} from '../utils.js';
|
||||
|
||||
import { generateObjectService } from '../ai-services-unified.js';
|
||||
import { getDebugFlag } from '../config-manager.js';
|
||||
import { getDebugFlag, getMainProvider, getResearchProvider, getDefaultPriority } from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import { displayAiUsageSummary } from '../ui.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
@@ -175,8 +175,6 @@ async function parsePRD(prdPath, tasksPath, numTasks, options = {}) {
|
||||
const promptManager = getPromptManager();
|
||||
|
||||
// Get defaultTaskPriority from config
|
||||
const { getDefaultPriority, getMainProvider, getResearchProvider } =
|
||||
await import('../config-manager.js');
|
||||
const defaultTaskPriority = getDefaultPriority(projectRoot) || 'medium';
|
||||
|
||||
// Check if Claude Code is being used as the provider
|
||||
|
||||
@@ -123,7 +123,9 @@ jest.unstable_mockModule(
|
||||
() => ({
|
||||
getDefaultSubtasks: jest.fn(() => 3),
|
||||
getDebugFlag: jest.fn(() => false),
|
||||
getDefaultNumTasks: jest.fn(() => 10)
|
||||
getDefaultNumTasks: jest.fn(() => 10),
|
||||
getMainProvider: jest.fn(() => 'openai'),
|
||||
getResearchProvider: jest.fn(() => 'perplexity')
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ jest.unstable_mockModule(
|
||||
() => ({
|
||||
getDebugFlag: jest.fn(() => false),
|
||||
getDefaultNumTasks: jest.fn(() => 10),
|
||||
getDefaultPriority: jest.fn(() => 'medium')
|
||||
getDefaultPriority: jest.fn(() => 'medium'),
|
||||
getMainProvider: jest.fn(() => 'openai'),
|
||||
getResearchProvider: jest.fn(() => 'perplexity')
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user